Sunaj Posted November 5, 2006 Share Posted November 5, 2006 (edited) Hi, I have a slight problem with my application, I need to open a child window & disable the mother window while the child is open (i.e. force the user to react to the opened window). The thing is that when using @SW_ENABLE to bring mother window back to life the window is automatically moved '1 window' back in the z-order (?!).. this forces me to use @SW_RESTORE - and the end-result is that there is quite a bit of unnessary GUI flickering on the screen, do any of you have an idea as to how to avoid this situation?! (btw, flicker does not appear in this example due to minimal GUI but I think it illustrates problem well enough...)Guess the optimal solution would be a disable/enable parameter pair that simply does not minimize the mother GUI..? Anyway, here is the code!expandcollapse popup#include <GUIConstants.au3> Opt("GUIOnEventMode", 1) $tabbed_options = GUICreate("Motherwindow", 200, 100) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") $okbutton = GUICtrlCreateButton("OK", 70, 50, 60) GUICtrlSetOnEvent($okbutton, "OKButton") GUISetState(@SW_SHOW) $NoticeBox=0 While 1 Sleep(500) WEnd Func OKButton() _NoticeBox("ChildWindow", "Child Window Opened") EndFunc Func CLOSEClicked() Exit EndFunc Func _NoticeBox($s_Caption,$s_Text) $size = WinGetPos ($tabbed_options) GUISetState (@SW_DISABLE, $tabbed_options) ; Mother is disabled $NoticeBox = GUICreate($s_Caption,335,118,($size[2]/2)-(335 / 2),($size[3]/2)-(118 / 2),"",$WS_EX_MDICHILD,$tabbed_options) $NoticeBox_Ok_Button = GUICtrlCreateButton ("OK",126,57,70) GUICtrlSetOnEvent($NoticeBox_Ok_Button, "NoticeBox_Ok_Button") GUICtrlCreateLabel($s_Text,40,23) GUISetState(@SW_SHOW,$NoticeBox) EndFunc Func NoticeBox_Ok_Button() GUIDelete($NoticeBox) GUISetState (@SW_ENABLE, $tabbed_options) ; Mother is enabled ; GUISetState (@SW_RESTORE, $tabbed_options) ; When not set Motherwindow stays moved '1 window' back in the z-order EndFuncEdit: bold on main problem..Edit: emphasized z-order aspect.. Edited November 6, 2006 by Sunaj [list=1][*]Generic way to detect full path to default browser, List/ListView Events Using GuiRegisterMsg (detect doubleclick and much more)[*]Using dllcall for full control over fileopendialog, Make DirMove act somewhat normally (by circumventing it...)[*]Avoid problems with "&" (chr(38)) in code, Change desktop maximized area/workspace (fx to make deskbar type app)[*]Change focus behavior when buttons are clicked to work closer to 'standard windows' app[*](Context) Menus With Timed Tooltips, Fast Loops & Operators in AU3[*]Clipboard UDF, A clipboard change notification udf[/list] Link to comment Share on other sites More sharing options...
Sunaj Posted November 5, 2006 Author Share Posted November 5, 2006 (edited) Bump.. Anyone? If the above code is not saveable.. (?) -is there anyway to tie standard Msgboxes in with a GUI so that they appear integral in the same way as pseudo-childwindow- msgbox does in the code above? Edited November 5, 2006 by Sunaj [list=1][*]Generic way to detect full path to default browser, List/ListView Events Using GuiRegisterMsg (detect doubleclick and much more)[*]Using dllcall for full control over fileopendialog, Make DirMove act somewhat normally (by circumventing it...)[*]Avoid problems with "&" (chr(38)) in code, Change desktop maximized area/workspace (fx to make deskbar type app)[*]Change focus behavior when buttons are clicked to work closer to 'standard windows' app[*](Context) Menus With Timed Tooltips, Fast Loops & Operators in AU3[*]Clipboard UDF, A clipboard change notification udf[/list] Link to comment Share on other sites More sharing options...
Richard Robertson Posted November 5, 2006 Share Posted November 5, 2006 MsgBox will pause the script until a response is chosen. I don't understand you disabling an entire window, and I didn't even think that would work. Link to comment Share on other sites More sharing options...
Sunaj Posted November 5, 2006 Author Share Posted November 5, 2006 (edited) Hi Icekirby1, I know that msgbox will pause the script. Try and go into SciTE and press "Open File" - you see how the OpenFileBox is enabled and still tied to the overall SciTE app (which is disabled) and when u try and click the disabled SciTE app the OpenFileBox flashes a few times - that is the -exact- effect I'm trying to mimic, almost all Windows XP..etc applications uses this approach. The problem outlined in my first posting is still unsolved.Seems the @SW_DISABLE/@SW_ENABLE combo causes a mess up in the z-order of the opened windows.. a bug in AutoIt? (possibly verify it through example provided, I'll check back on subject tomorrow morning, so far its the same whether i use the beta or not)MsgBox will pause the script until a response is chosen. I don't understand you disabling an entire window, and I didn't even think that would work. Edited November 5, 2006 by Sunaj [list=1][*]Generic way to detect full path to default browser, List/ListView Events Using GuiRegisterMsg (detect doubleclick and much more)[*]Using dllcall for full control over fileopendialog, Make DirMove act somewhat normally (by circumventing it...)[*]Avoid problems with "&" (chr(38)) in code, Change desktop maximized area/workspace (fx to make deskbar type app)[*]Change focus behavior when buttons are clicked to work closer to 'standard windows' app[*](Context) Menus With Timed Tooltips, Fast Loops & Operators in AU3[*]Clipboard UDF, A clipboard change notification udf[/list] Link to comment Share on other sites More sharing options...
Sunaj Posted November 6, 2006 Author Share Posted November 6, 2006 I really need someone to look at this.. at least to verify whether it should be filed as a bug or its just a odd thing in my code causing it! Seems the @SW_DISABLE/@SW_ENABLE combo causes a mess up in the z-order of the opened windows.. a bug in AutoIt? (possibly verify it through example provided (if example is opened from SciTE it will be easy to observe), so far the issue remains whether i use the beta or not). [list=1][*]Generic way to detect full path to default browser, List/ListView Events Using GuiRegisterMsg (detect doubleclick and much more)[*]Using dllcall for full control over fileopendialog, Make DirMove act somewhat normally (by circumventing it...)[*]Avoid problems with "&" (chr(38)) in code, Change desktop maximized area/workspace (fx to make deskbar type app)[*]Change focus behavior when buttons are clicked to work closer to 'standard windows' app[*](Context) Menus With Timed Tooltips, Fast Loops & Operators in AU3[*]Clipboard UDF, A clipboard change notification udf[/list] Link to comment Share on other sites More sharing options...
Cue Posted November 8, 2006 Share Posted November 8, 2006 (edited) I do not know what you mean by flicker or "the window is automatically moved '1 window' back in the z-order" but i thinkI also have a similar problem with my main gui minimizing after a messagebox. I m currently not using the beta but i suspect that its a problem with my coding because Ive never really understood most of the GUI control styles. I remember reading about using a Gui style to avoid flicker. Edited November 8, 2006 by Cue Link to comment Share on other sites More sharing options...
chie Posted November 10, 2006 Share Posted November 10, 2006 Guess I would recommend just to use GUISetState(@SW_HIDE,$NoticeBox) since then no data is lost, instead of GUIDelete($NoticeBox), if this is not what you want explane it the way anyone can understand you. Func _NoticeBox($s_Caption,$s_Text) $size = WinGetPos ($tabbed_options) $NoticeBox = GUICreate($s_Caption,335,118,($size[2]/2)-(335 / 2),($size[3]/2)-(118 / 2),"",$WS_EX_MDICHILD,$tabbed_options) $NoticeBox_Ok_Button = GUICtrlCreateButton ("OK",126,57,70) GUICtrlSetOnEvent($NoticeBox_Ok_Button, "NoticeBox_Ok_Button") GUICtrlCreateLabel($s_Text,40,23) GUISetState(@SW_SHOW,$NoticeBox) EndFunc Func NoticeBox_Ok_Button() GUISetState(@SW_HIDE,$NoticeBox) ; simply Hide the NoticeBox EndFunc Link to comment Share on other sites More sharing options...
Sunaj Posted November 11, 2006 Author Share Posted November 11, 2006 Thanks for your input chie (I think we understand each other just fine) - I think this topic thread can be considered closed since I found a much cleaner and better solution in this thread (involves DllCall, so anyone trying to avoid DllCalls (?..) may want to try your proposed solution)! Guess I would recommend just to use GUISetState(@SW_HIDE,$NoticeBox) since then no data is lost, instead of GUIDelete($NoticeBox), if this is not what you want explane it the way anyone can understand you. Func _NoticeBox($s_Caption,$s_Text) $size = WinGetPos ($tabbed_options) $NoticeBox = GUICreate($s_Caption,335,118,($size[2]/2)-(335 / 2),($size[3]/2)-(118 / 2),"",$WS_EX_MDICHILD,$tabbed_options) $NoticeBox_Ok_Button = GUICtrlCreateButton ("OK",126,57,70) GUICtrlSetOnEvent($NoticeBox_Ok_Button, "NoticeBox_Ok_Button") GUICtrlCreateLabel($s_Text,40,23) GUISetState(@SW_SHOW,$NoticeBox) EndFunc Func NoticeBox_Ok_Button() GUISetState(@SW_HIDE,$NoticeBox) ; simply Hide the NoticeBox EndFunc [list=1][*]Generic way to detect full path to default browser, List/ListView Events Using GuiRegisterMsg (detect doubleclick and much more)[*]Using dllcall for full control over fileopendialog, Make DirMove act somewhat normally (by circumventing it...)[*]Avoid problems with "&" (chr(38)) in code, Change desktop maximized area/workspace (fx to make deskbar type app)[*]Change focus behavior when buttons are clicked to work closer to 'standard windows' app[*](Context) Menus With Timed Tooltips, Fast Loops & Operators in AU3[*]Clipboard UDF, A clipboard change notification udf[/list] Link to comment Share on other sites More sharing options...
Richard Robertson Posted November 11, 2006 Share Posted November 11, 2006 Even though I still fail to understand the problem, I'm glad it was solved. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now