Why is there no Window.enabled property?

I was surprised to find there is no .enabled property for a Window.
Is there a sensible reason for that?

What is a disabled window ?

A window with nothing working in it. I do not understand when I can need this kind of window. (I hope the Close button is enabled in that window… :grinning:)

That said, I do not foundWindow.Disabled too.

Yes. One I do not want to hide, and cannot throw a modal window from, but which I do not want to accept mouse events for a while.

A disabled window is necessary during “running conditions” or when it is not allowed to change parameters on that window. You have to write a code that enables/dis-enables every single button. Really uncomfortable, but it works.

Another approach I have taken is to put a canvas over the section I don’t disturbed and make it visible until I’m finished. I put in large letters 'Processing…" or some such. That way I didn’t have to code each control.

3 Likes

How did you deal with preventing the user to use the tab key to move the focus to other controls (and then type something) or other accessibility features?

There are so many approaches, it typically depends on your design and balancing how much work you want to do vs how it looks and responds. I’ve done each of these or variations on them over the past several years.

Window.hide and upon completion window.show

Create an app property like p_processing = True - then a timer that runs while processing and shuts off after a False is written. That timer turns off / on properties

Seems like there was an introspection of some sort where you could actually loop through objects and flip ‘Accept Tabs’ on or off accordingly - I have never used it and don’t know if it still exists and I may be thinking of another language that did that.

In a timer(s), just flip properties on or off (in this case ‘Accept Tabs’) as needed.

Every situation seems to require a different approach.

Hope this helps.

I’m not sure if someone has suggested it yet, if you put a canvas on the form and place all your controls in that (set their parent to the canvas) you can disable the canvas set .Enabled on the canvas and all controls within with disable. Again set Canvas1.enabled to true and they are back the way they were.

It prevents anything that disabling the individual controls would have done…

3 Likes

There is no enabled property probably because a window is disabled when not in front, and users expect it to become enabled when they click on it to make it front.

If a user clicks on a window and it stays disabled, he will most probably believe the program malfunctioned and hung.

Perhaps the best course of action is simply to hide the window.

In my opinion, the “standard” way to handle this is to put a modal dialog up. The modal dialog has a progress bar (and possibly a “Cancel”) button if the operation is something that can be canceled.

Is there a reason you can’t do that here?

One use case is having multiple windows with parallel functionalities that could be ok and responsive, but just one window showing something important, but dependent of something being done, and that window could be disabled while such dependency is fulfilled, then re-enabled. A modal request will stop all the UI.

That said, there are other systems that have such capability of disabling/enabling windows.

The drawbacks your post suggest are related to developer choices.

For example, ShowModal(ParentWindow) (the new version of ShowModalWithin) only blocks the document that’s currently processing on macOS. You can have multiple documents processing with a properly designed progress system. ShowModalWithin system also allows the UI of other available windows to continue accepting input.

In the spirit of looking at this from all angles, I don’t think the ShowWithin system works the same on Windows. But on macOS it’s very useful and can be done really well.

Something useless for 78% of the desktop platforms is not a generalist solution. And even for MacOS, what if the user wanted block 2 panels (windows) both involved in parameters for the current task? He still would need to disable 2 of those. Probably today they just hide them.