Should a Container Control's Mouse up/enter/exit events be triggered if it's disabled?

I would like a container control (a set of custom buttons) to be disabled until a few criteria set elsewhere are satisfied. By “disabled” I mean that I don’t want it to give any feedback to the user, if you mouse over it. I have set its Enabled state to false on window open, but when I mouse over it, it’s still responding as I’d expect it to (button states are changing to show it’s being hovered over), as if it was enabled.

Is this expected behavior? If so, is there a simple way to disable the whole container control so that mousing over, exiting, and clicking are all ignored until it’s enabled?

Yes it’s expected. You can easily track it and return if you don’t need it.

if not me.Enabled then return

Some functionality should be disabled in line with the os but some things like MouseEnter etc are good to have available as you can use them for things like popups/changing the states of labels letting you know to turn something on to enable the control etc. If you need to turn that feature off see above ^^

But this needs to be done in multiple events (mouse up, mouse exit, mouse enter, etc), no?

What I’d like is to turn the entire control container off so that nothing within the container works until it’s safe for those controls to be used, ideally doing this in just one spot. Is that not possible? If not it means adding this test to 12 separate events in this one cluster of buttons.

If I have a container control that’s got an instance in a window, and I disable that instance (using Xojo’s Enable property), what does that actually do (just set a flag?). because it seems to allow me to continue to use the controls as if they were enabled. It’s kind of counterintuitive.

Even if you disable one of the controls on the disabled container control it still reacts to certain events, just not certain os things like tabbing into a controls or giving it focus with the mouse etc.

This is why some people recommend subclassing every control before you use them so you can perform things like this once and have it happen on all similar controls.

Ok, I just tried returning if it’s disabled, in the mouse move event. This works to effectively disable the controls. But only if i disable the instance of that container that’s in my window.

That is, the parent container control is called FilmTransport. The instance in my window is FilmTransport1, and is a scaled down version of it. I’m responding to all events in the parent container (FilmTransport). Enabling/disabling that parent has no effect.

However, if I set Enabled to false in the child, FilmTransport1, then it works as described above. I guess I would have expected that if the test in the mouse move event is happening in the parent, disabling the parent would disable my controls in the way I want.

Yes, setting the Enabled = False state on the actual ContainerControl (FilmTransport) only means that when you create an instance of it on your window (FilmTransport1), it will use that setting when the control is added to your window. Subsequently, changing settings of the ContainerControl (FilmTransport) will not be made to FilmTransport1 after it has been added to the Window. Think of it as “default settings”.


Of course. That makes perfect sense. Thanks!