Rex Posted February 23, 2010 Share Posted February 23, 2010 Is this possible ? I have a main gui, and several child gui's in my script. Some of the child gui handles some input and so. What i need is to pause a function until a child gui windows closes, but without pausing the entire script. for now i do something like this. GuiSetState(@SW_SHOW, $ChildGUI) winactivate($ChildGUI, "") ; Child contains some inputboxes and an activation button and an exit button _Function() Func _Funftion() winwaitclose($ChildGUI, "") msgBox(16, "Msg", "Msg") EndFunc My problem is that the winwaitclose pauses the entire script, so the user can not use the buttons in the childGUI I did try to put in a do until, and a while 1 wend and the all blocks the use of the child gui Is there any way to do this, or do i have to loop forth and back until the child is closed? Cheers /Rex Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 23, 2010 Share Posted February 23, 2010 Switch your script to GuiOnEventMode. The events actions will interrupt most things like WinWaitClose(). Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 23, 2010 Moderators Share Posted February 23, 2010 Rex,Without sight of the code proper, this is only a SWAG.You could use an Adlib function to check if the window still exists:#include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) $hLabel = GUICtrlCreateLabel("", 10, 10, 100, 20) $hButton = GUICtrlCreateButton("Child", 10, 50, 80, 30) GUISetState() While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[1] Case $hGUI Switch $aMsg[0] Case $GUI_EVENT_CLOSE Exit Case $hButton $hChild = GUICreate("Child", 200, 100, 100, 100) GUISetState() AdlibRegister("_Check_Child") EndSwitch Case Else If $aMsg[0] = $GUI_EVENT_CLOSE Then GUIDelete($hChild) EndSwitch WEnd Func _Check_Child() If Not WinExists($hChild) Then MsgBox(0, "Child", "No longer there!") AdlibUnRegister("_Check_Child") EndIf EndFuncAsk if anything is unclear. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Rex Posted February 23, 2010 Author Share Posted February 23, 2010 Switch your script to GuiOnEventMode. The events actions will interrupt most things like WinWaitClose().I always run in Guioneventmode , but still the winwait ect. still blocks until i do a hardkill Cheers/Rex Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 23, 2010 Share Posted February 23, 2010 I always run in Guioneventmode , but still the winwait ect. still blocks until i do a hardkill No it doesn't: #include <GuiConstantsEx.au3> Opt("GuiOnEventMode", 1) $hGUI = GUICreate("Test", 300, 300) GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit") GUICtrlCreateButton("ONE", 100, 100, 100, 30) GUICtrlSetOnEvent(-1, "_ButtonHit") GUICtrlCreateButton("TWO", 100, 150, 100, 30) GUICtrlSetOnEvent(-1, "_ButtonHit") GUISetState() _WaitForIt() Func _WaitForIt() WinWaitClose($hGUI) MsgBox(64, "Closed", "Window Closed") EndFunc Func _Quit() GUIDelete($hGUI) EndFunc Func _ButtonHit() Local $sText = ControlGetText($hGUI, "", @GUI_CtrlId) MsgBox(64, "Button Hit", "You clicked: " & $sText) EndFunc The code you posted does not use event mode. Post a demo where you use event mode and get blocking. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Rex Posted February 23, 2010 Author Share Posted February 23, 2010 Rex, Without sight of the code proper, this is only a SWAG. You could use an Adlib function to check if the window still exists: #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) $hLabel = GUICtrlCreateLabel("", 10, 10, 100, 20) $hButton = GUICtrlCreateButton("Child", 10, 50, 80, 30) GUISetState() While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[1] Case $hGUI Switch $aMsg[0] Case $GUI_EVENT_CLOSE Exit Case $hButton $hChild = GUICreate("Child", 200, 100, 100, 100) GUISetState() AdlibRegister("_Check_Child") EndSwitch Case Else If $aMsg[0] = $GUI_EVENT_CLOSE Then GUIDelete($hChild) EndSwitch WEnd Func _Check_Child() If Not WinExists($hChild) Then MsgBox(0, "Child", "No longer there!") AdlibUnRegister("_Check_Child") EndIf EndFunc Ask if anything is unclear. M23 Hi Melba i think that this is eact what i need for my prog. Did't new that that func existed thru i did a help file search before posting I will try to put it into my code, and then repost tomorrow when i have tryed it a bit Cheers /Rex Link to comment Share on other sites More sharing options...
Rex Posted February 23, 2010 Author Share Posted February 23, 2010 Have one Q. In the adlib...("func") how do i add extra options to load in function eg. func _Func($1, $2) endfunc cant finde any info in help file either. Cheers /Rex Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 23, 2010 Moderators Share Posted February 23, 2010 rex,What i need is to pause a function until a child gui windows closes, but without pausing the entire scriptchild gui handles some input and soAdlib lets you run your main script and interrupts at intervals. It could check whether there is any input in the child window, but as I said at the beginning, without sight of some code this is all guesswork. Give us some concrete details of what you want the child to do and what your main script is doing while waiting. Then we can see what might work.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Rex Posted February 24, 2010 Author Share Posted February 24, 2010 rex,Adlib lets you run your main script and interrupts at intervals. It could check whether there is any input in the child window, but as I said at the beginning, without sight of some code this is all guesswork. Give us some concrete details of what you want the child to do and what your main script is doing while waiting. Then we can see what might work.M23The Adlib.. works as a charm My q was only becorse i did't wanned to make a var global, but insted send the var's result to the function )Like _Func("data")Func _Func($Data)Somthing here endfuncBut i can't find out how to put the ("Data") in the adlib func call Cheers/Rex Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 24, 2010 Moderators Share Posted February 24, 2010 Rex, But i can't find out how to put the ("Data") in the adlib func callAf far as I know, you cannot pass parameters to an Adlib function - which is why you cannot find out how do do it! Looks like Global will have to do. I did find this UDF which allows you to pass parameters to a function which is called at intervals. I have never used it, so I have no idea if it works well, but you might find it useful. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Rex Posted February 24, 2010 Author Share Posted February 24, 2010 Rex, Af far as I know, you cannot pass parameters to an Adlib function - which is why you cannot find out how do do it! Looks like Global will have to do. I did find this UDF which allows you to pass parameters to a function which is called at intervals. I have never used it, so I have no idea if it works well, but you might find it useful. M23 Yes the globals it was ) The udf looks cool, but i recall somthing about the adlib-en/dis-able was removed and replaced by adlib-reg/unreg, thoe i only skimmed the code of the udf. Cheers /Rex 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