Jump to content

ucsAdmin

Members
  • Posts

    2
  • Joined

  • Last visited

ucsAdmin's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. I found an other and much better solution in ArrayEdt script. Thanks to the contributor for it !!!! It's really great ! I don't know if it's not bad to switch between message and event mode but it works fine Hope it will help somebody. It helps me ; This sample works #################################################################################################### ######################################## #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode $First_level_window = GUICreate("First level window", 300, 100, 100,100) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") $okbutton1 = GUICtrlCreateButton("Open 2nd level window", 70, 50, 200) GUICtrlSetOnEvent($okbutton1, "OKButton1") GUISetState(@SW_SHOW) $Second_level_window = GUICreate("Second level window ", 200, 100,300,300) GUICtrlCreateLabel("It works", 30, 10) $okbutton2 = GUICtrlCreateButton("Open msgbox", 70, 50, 80) While 1 sleep(100) ; Idle around WEnd Func OKButton1() Open_second_level_window() EndFunc Func Open_second_level_window() Local $oldGuiOnEventMode ; important stuff to do here !!!!!!!!!!! $oldGuiOnEventMode = AutoItSetOption('GuiOnEventMode',0) GUISwitch($Second_level_window) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case 0 ContinueLoop Case $okbutton2 OKButton2() GUISetState(@SW_HIDE) ExitLoop EndSwitch Sleep(20) ; Idle around WEnd ; important stuff to do here !!!!!!!!!!! AutoItSetOption('GuiOnEventMode',$oldGuiOnEventMode) EndFunc Func OKButton2() msgBox(0, "GUI Event", "It works!") EndFunc Func CLOSEClicked() MsgBox(0, "GUI Event", "You clicked CLOSE ! Exiting...") Exit EndFunc
  2. Hello First of all, congratulation to AutoIt team !!!!! Such a great work ! In a window (called 1st level) I need to create a second window (called 2nd level) by a button event (first event) then set several controls datas in it then show this window then wait this window to be closed by a button event (second event) then retrieve informations from controls in the 2nd level window to use it in first level I need to use event mode the problem is : in the first fired event, it seems impossible to fire an other event (need confirmation) so a loop in this event won't work to work I guess it is necessary to go out of the first event Below is the code I used to show the problem and the one to make it work My question is : is there a simpler way to do it ? cause it will be a bit heavy to code. Thanks for replies ;This sample doesn't work #################################################################################################### ######################################## #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode $First_level_window = GUICreate("First level window", 300, 100, 100,100) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") $okbutton1 = GUICtrlCreateButton("Open 2nd level window", 70, 50, 200) GUICtrlSetOnEvent($okbutton1, "OKButton1") GUISetState(@SW_SHOW) $Open_second_level_window = False While 1 sleep(1000) ; Idle around WEnd Func OKButton1() ; It doesn't work : Open_second_level_window() EndFunc Func Open_second_level_window() $Second_level_window = GUICreate("Second level window ", 200, 100,300,300) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GUICtrlCreateLabel("It doesn't work", 30, 10) $okbutton2 = GUICtrlCreateButton("Open msgbox", 70, 50, 80) GUICtrlSetOnEvent($okbutton2, "OKButton2") GUISwitch($Second_level_window) ; important stuff to do here !!!!!!!!!!! GUISetState(@SW_SHOW) While 1 Sleep(1000) ; Idle around WEnd ; important stuff to do here !!!!!!!!!!! EndFunc Func OKButton2() msgBox(0, "GUI Event", "It works!") EndFunc Func CLOSEClicked() MsgBox(0, "GUI Event", "You clicked CLOSE ! Exiting...") Exit EndFunc ;~; This sample works #################################################################################################### ######################################## ;~ #include <GUIConstantsEx.au3> ;~ Opt("GUIOnEventMode", 1) ; Change to OnEvent mode ;~ $First_level_window = GUICreate("First level window", 300, 100, 100,100) ;~ GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") ;~ $okbutton1 = GUICtrlCreateButton("Open 2nd level window", 70, 50, 200) ;~ GUICtrlSetOnEvent($okbutton1, "OKButton1") ;~ GUISetState(@SW_SHOW) ;~ $Open_second_level_window = False ;~ While 1 ;~ sleep(1000) ; Idle around ;~ If $Open_second_level_window = True Then ;~ $Open_second_level_window = False ;~ Open_second_level_window() ;~ EndIf ;~ WEnd ;~ Func OKButton1() ;~ ; It works : ;~ $Open_second_level_window = true ;~ EndFunc ;~ Func Open_second_level_window() ;~ $Second_level_window = GUICreate("Second level window ", 200, 100,300,300) ;~ GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") ;~ GUICtrlCreateLabel("It doesn't work", 30, 10) ;~ $okbutton2 = GUICtrlCreateButton("Open msgbox", 70, 50, 80) ;~ GUICtrlSetOnEvent($okbutton2, "OKButton2") ;~ GUISwitch($Second_level_window) ;~ ; important stuff to do here !!!!!!!!!!! ;~ GUISetState(@SW_SHOW) ;~ While 1 ;~ Sleep(1000) ; Idle around ;~ WEnd ;~ ; important stuff to do here !!!!!!!!!!! ;~ EndFunc ;~ Func OKButton2() ;~ msgBox(0, "GUI Event", "It works!") ;~ EndFunc ;~ Func CLOSEClicked() ;~ MsgBox(0, "GUI Event", "You clicked CLOSE ! Exiting...") ;~ Exit ;~ EndFunc
×
×
  • Create New...