Form that is showing dialog box is disabled - looses behavior of when showing dialogbox
-
Hello, Here is the situtation: 1 exe (acting like main menu) that launches 1-N dlls where each dll is seperate application. The exe and dlls all are sharing the same memory for the environment. We have a business requirement that if one of the applications is showing a dialog box, it cannot lock up the other running applications-ugly work around but we have accomplished this. Because N number of windows can be running at once there is a feature called, clever enough, "Show Open Windows" which when shows disables all the running forms so that the user must get rid of showopen windows before they can do anything else. While this action was not a problem, if any of those forms where showing dialogboxes then the dialog boxes were still enabled allowing the user to interact with them. I created an extension to the form to use a custom ShowDialog routine that setup an event that if the calling form's enabled problem changed then change the enabled property within the dialog box works fine. The problem is if the parent form(one that showed the dialog) is disabled by the "show open windows" call, when it is reenabled by the showopenwindows going away, the dialog remains on top of the calling form but you can interact with the calling form - changing it's context etc. This is easily repeatable including if you use a msgbox. Is there any value/flag that I can test for and reset to get the form back into the state where you can't interact with it until it's dialogbox goes away? Example of the code to make this behavior happen: 'note #1: the first timer was used to check the enabled property for it's state 'note #2: the second timer disables the form 5 seconds after you click on the button to show the messagebox. 5 seconds after that the form will reenable allowing you to interact with it even though the message box is still showing.
Public Class Form1
Private _timer As Timer
Private _timerdisable As TimerPrivate Sub Form1\_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load \_timer = New Timer(500) \_timer.AutoReset = True AddHandler \_timer.Elapsed, AddressOf Timer\_Elapsed \_timer.Enabled = True \_timerdisable = New Timer(5000) \_timerdisable.AutoReset = True AddHandler \_timerdisable.Elapsed, AddressOf TimerDisable\_Elapsed End Sub Private Sub Timer\_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) If Me.InvokeRequired Then Me
-
Hello, Here is the situtation: 1 exe (acting like main menu) that launches 1-N dlls where each dll is seperate application. The exe and dlls all are sharing the same memory for the environment. We have a business requirement that if one of the applications is showing a dialog box, it cannot lock up the other running applications-ugly work around but we have accomplished this. Because N number of windows can be running at once there is a feature called, clever enough, "Show Open Windows" which when shows disables all the running forms so that the user must get rid of showopen windows before they can do anything else. While this action was not a problem, if any of those forms where showing dialogboxes then the dialog boxes were still enabled allowing the user to interact with them. I created an extension to the form to use a custom ShowDialog routine that setup an event that if the calling form's enabled problem changed then change the enabled property within the dialog box works fine. The problem is if the parent form(one that showed the dialog) is disabled by the "show open windows" call, when it is reenabled by the showopenwindows going away, the dialog remains on top of the calling form but you can interact with the calling form - changing it's context etc. This is easily repeatable including if you use a msgbox. Is there any value/flag that I can test for and reset to get the form back into the state where you can't interact with it until it's dialogbox goes away? Example of the code to make this behavior happen: 'note #1: the first timer was used to check the enabled property for it's state 'note #2: the second timer disables the form 5 seconds after you click on the button to show the messagebox. 5 seconds after that the form will reenable allowing you to interact with it even though the message box is still showing.
Public Class Form1
Private _timer As Timer
Private _timerdisable As TimerPrivate Sub Form1\_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load \_timer = New Timer(500) \_timer.AutoReset = True AddHandler \_timer.Elapsed, AddressOf Timer\_Elapsed \_timer.Enabled = True \_timerdisable = New Timer(5000) \_timerdisable.AutoReset = True AddHandler \_timerdisable.Elapsed, AddressOf TimerDisable\_Elapsed End Sub Private Sub Timer\_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) If Me.InvokeRequired Then Me
You could also try to create non-blocking variants of the dialogs; Show a window, set a boolean to indicate that it's showing something. When the flag gets
set
, attach a delegate to one of the events that fire when the form closes to reset the bool.I are Troll :)
-
You could also try to create non-blocking variants of the dialogs; Show a window, set a boolean to indicate that it's showing something. When the flag gets
set
, attach a delegate to one of the events that fire when the form closes to reset the bool.I are Troll :)
Thank you for replying... "non-blocking variants of the dialogs;" - not doable... too much code would need to change to mimic the dialog behavior with the calling form.
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous 'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
-
Hello, Here is the situtation: 1 exe (acting like main menu) that launches 1-N dlls where each dll is seperate application. The exe and dlls all are sharing the same memory for the environment. We have a business requirement that if one of the applications is showing a dialog box, it cannot lock up the other running applications-ugly work around but we have accomplished this. Because N number of windows can be running at once there is a feature called, clever enough, "Show Open Windows" which when shows disables all the running forms so that the user must get rid of showopen windows before they can do anything else. While this action was not a problem, if any of those forms where showing dialogboxes then the dialog boxes were still enabled allowing the user to interact with them. I created an extension to the form to use a custom ShowDialog routine that setup an event that if the calling form's enabled problem changed then change the enabled property within the dialog box works fine. The problem is if the parent form(one that showed the dialog) is disabled by the "show open windows" call, when it is reenabled by the showopenwindows going away, the dialog remains on top of the calling form but you can interact with the calling form - changing it's context etc. This is easily repeatable including if you use a msgbox. Is there any value/flag that I can test for and reset to get the form back into the state where you can't interact with it until it's dialogbox goes away? Example of the code to make this behavior happen: 'note #1: the first timer was used to check the enabled property for it's state 'note #2: the second timer disables the form 5 seconds after you click on the button to show the messagebox. 5 seconds after that the form will reenable allowing you to interact with it even though the message box is still showing.
Public Class Form1
Private _timer As Timer
Private _timerdisable As TimerPrivate Sub Form1\_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load \_timer = New Timer(500) \_timer.AutoReset = True AddHandler \_timer.Elapsed, AddressOf Timer\_Elapsed \_timer.Enabled = True \_timerdisable = New Timer(5000) \_timerdisable.AutoReset = True AddHandler \_timerdisable.Elapsed, AddressOf TimerDisable\_Elapsed End Sub Private Sub Timer\_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) If Me.InvokeRequired Then Me
Turns out, the value/flag in question is the property 'CanFocus'. This property is of course 'readonly'. Does anyone know how to override this value behind the scenes(api call or whatever)? thank you Nathan
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous 'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous