How to Disable entire Dialog Screen

Is there a way to disable or deactivate a Dialog screen to prevent any user interaction with it , without having to disable each of its controls ?
precisely what i need is to disallow the user to click on any of the Dialog’s inner controls like buttons etc. when a macro is executing.

A technique I tried is dalog setvisible(false) and then back to true but it causes a visible screen flicker which I dont want.

I have also tried embedding a Frame window in the dialog using window descriptor create window which creates a transparent window within the Dialog which covers the screen and blocks user interaction so it does what i need but again the screen Flicker is clearly seen.

I need the Dialog screen to look just normal but it has to be blocked or freezed whenever I need while a macro runs in the background
can this be done ?

How long does a macro take to execute?

You have tons of possibilities, I will name three of them.

First, reconsider the algorithm of your macro - quite often a poorly thought-out algorithm can be improved so much that the code execution time is reduced to fractions of a second, the user simply will not have time to press something during this time.

The second solution to the problem is to add a global boolean variable to the module, something like bInProcess. Whenever you handle events from dialog controls, first check to see if this variable is TRUE. If so, exit procedure and do nothing. Otherwise, set the variable to TRUE, execute the code and reset the value to FALSE before exiting the procedure.

The third solution is to create another modal dialog, in which there will be nothing but a progress bar. Until your macro closes this dialog itself, the controls of the parent dialog should not fire events.

Let me explain more in detail so u’ll get an idea of why my situation is a tricky one.
so I have a few Listboxes in my dialog - the ones without a dropdown.
user is free to select multiple items in them.
The moment any Listbox item is selected, either with a mouse click OR may be with the keyboard up down keys, I need to trigger a macro to reset the other Listbox items depending on what item was selected in the clicked Listbox.
this involves adding or removing items from the other Listboxes.
Now I have a button which also manipulates the same set of ListBoxes - adding or removing or even selecting items in them based on my code Logic.

here comes my problem
lets say this button is clicked and the button macro starts changing the Listboxes accordingly and the user clicks one of these Listboxes instantly before the macro finishes - it may be a second or 2 before this button click macro has finished doing its job.
here there will be an obvious clash since the Listbox selection change macro will be triggered which will try to set the Listboxes differently at the same time.

To tackle this I can use a global boolean to check if a macro is already executing,
so if yes then don’t do anything - but there’s one thing it will not handle -
that’s the situation where the user has somehow changed a Listbox selection while another macro was on - so the macro that was supposed to reset the other Listboxes on this change will not execute and that will leave the set of Listboxes in an incorrect state.
I don’t want this happening. At any point of time all Listboxes must reflect their proper state based on whatever is selected in them.
in other words all listboxes must contain only those items as per my logic which is what the selection change macro does. it adds or removes items from all Listboxes as necessary to reflect the changed state of the clicked Listbox

The main problem here in short is - I can prevent macros from executing by using this boolean or whatever check, but I cannot prevent a ListBox item from being selected.
The selection will happen anyway when the mouse is clicked and the item turns blue.

So the only safe clean way to prevent this possibility in my case is to simply not allow the user to change or touch anything when something is running already.
this can of course be done by disabling the required controls as necessary or blocking the screen with a transparent frame - which is what I’ve tried and these methods all work fine except that they cause a display flicker which I’m looking to avoid.

You can use the Enabled or Visible properties of controls while modifying by macro.