ddeerr Posted August 11, 2006 Share Posted August 11, 2006 hi all, I have again a problem with the event manager GuiGetMsg(). When i specified to get event from my secondary GUI windows the first GUI doesn't run. I guess that's because i create the secondary window after processing steps beginning the first one. I show you : expandcollapse popupmMain() Func mMain() ; usually this windows is created and works well Global $fenetrePrincipale Global $inputValAchercher, $bouttonRecherche, $bouttonExit, $imageFond, $imageAttache $imageFond = _TempFile() FileInstall("2.jpg",$imageFond) $fenetrePrincipale = GUICreate(".RegChecK Papa.", 245, 130, 350, 350, $WS_CAPTION + $WS_SYSMENU + $WS_VISIBLE, $WS_EX_CONTEXTHELP + $WS_EX_STATICEDGE) If $fenetrePrincipale <> 0 Then $imageAttache = GUICtrlCreatePic($imageFond, 0, 0, 245, 130) GUICtrlSetState($imageAttache, $GUI_DISABLE) $inputValAchercher = GUICtrlCreateInput("", 20, 20, 200, 22) $bouttonRecherche = GUICtrlCreateButton("Chercher", 20, 50, 200, 25) $bouttonExit = GUICtrlCreateButton("Sortir", 20, 85, 200, 25) GUISetState(@SW_SHOW, $fenetrePrincipale) GUI_Life() Else MsgBox(0, "ERREUR", "impossible de créer la fenêtre") EndIf EndFunc Func GUI_Life() Local $eventsGUI ; here evrything is working usually good While 1 $eventsGUI = GUIGetMsg(1) Select Case $eventsGUI[0] = $GUI_EVENT_CLOSE If $eventsGUI[1] = $fenetrePrincipale Then FileDelete($imageFond) ExitLoop ElseIf $eventsGUI[1] = $fenetreRapport Then GUIDelete($fenetreRapport) GUISwitch($fenetrePrincipale) EndIf Case $eventsGUI[0] = $bouttonExit FileDelete($imageFond) ExitLoop Case $eventsGUI[0] = $bouttonRecherche GUICtrlSetState($inputValAchercher, $GUI_DISABLE) GUICtrlSetState($bouttonRecherche, $GUI_DISABLE) GUICtrlSetState($bouttonExit, $GUI_DISABLE) regCheck(GUICtrlRead($inputValAchercher)) ; execpt here when i ask to get event from the secondary windows directly ; in another hand the event GUI_EVENT_CLOSE (first case of this select) is working well Case $eventsGUI[0] = $menuSave MsgBox(0, "", "fhgdfhgjdfjk") EndSelect WEnd EndFunc i used autoit beta 3.1.1.133 tx Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 11, 2006 Share Posted August 11, 2006 hi all, I have again a problem with the event manager GuiGetMsg(). When i specified to get event from my secondary GUI windows the first GUI doesn't run. I guess that's because i create the secondary window after processing steps beginning the first one. I show you : CODE mMain() Func mMain() ; usually this windows is created and works well Global $fenetrePrincipale Global $inputValAchercher, $bouttonRecherche, $bouttonExit, $imageFond, $imageAttache $imageFond = _TempFile() FileInstall("2.jpg",$imageFond) $fenetrePrincipale = GUICreate(".RegChecK Papa.", 245, 130, 350, 350, $WS_CAPTION + $WS_SYSMENU + $WS_VISIBLE, $WS_EX_CONTEXTHELP + $WS_EX_STATICEDGE) If $fenetrePrincipale <> 0 Then $imageAttache = GUICtrlCreatePic($imageFond, 0, 0, 245, 130) GUICtrlSetState($imageAttache, $GUI_DISABLE) $inputValAchercher = GUICtrlCreateInput("", 20, 20, 200, 22) $bouttonRecherche = GUICtrlCreateButton("Chercher", 20, 50, 200, 25) $bouttonExit = GUICtrlCreateButton("Sortir", 20, 85, 200, 25) GUISetState(@SW_SHOW, $fenetrePrincipale) GUI_Life() Else MsgBox(0, "ERREUR", "impossible de créer la fenêtre") EndIf EndFunc Func GUI_Life() Local $eventsGUI ; here evrything is working usually good While 1 $eventsGUI = GUIGetMsg(1) Select Case $eventsGUI[0] = $GUI_EVENT_CLOSE If $eventsGUI[1] = $fenetrePrincipale Then FileDelete($imageFond) ExitLoop ElseIf $eventsGUI[1] = $fenetreRapport Then GUIDelete($fenetreRapport) GUISwitch($fenetrePrincipale) EndIf Case $eventsGUI[0] = $bouttonExit FileDelete($imageFond) ExitLoop Case $eventsGUI[0] = $bouttonRecherche GUICtrlSetState($inputValAchercher, $GUI_DISABLE) GUICtrlSetState($bouttonRecherche, $GUI_DISABLE) GUICtrlSetState($bouttonExit, $GUI_DISABLE) regCheck(GUICtrlRead($inputValAchercher)) ; execpt here when i ask to get event from the secondary windows directly ; in another hand the event GUI_EVENT_CLOSE (first case of this select) is working well Case $eventsGUI[0] = $menuSave MsgBox(0, "", "fhgdfhgjdfjk") EndSelect WEnd EndFunc i used autoit beta 3.1.1.133 tx I don't get it... I only see one GuiCreate(), and in the Case $eventsGUI[0] = $menuSave, there is nothing to set $menuSave to a usefull control ID or event ID. So where does the "secondary window" come from, and what is $menuSave representing? 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...
ddeerr Posted August 11, 2006 Author Share Posted August 11, 2006 It is when i call regCheck Function, i create another GUI expandcollapse popup#include <GUIConstants.au3> #include <file.au3> #include <Array.au3> mMain() Func mMain() ; usually this windows is created and works well Global $fenetrePrincipale Global $inputValAchercher, $bouttonRecherche, $bouttonExit, $imageFond, $imageAttache $fenetrePrincipale = GUICreate(".RegChecK Papa.", 245, 130, 350, 350, $WS_CAPTION + $WS_SYSMENU + $WS_VISIBLE, $WS_EX_CONTEXTHELP + $WS_EX_STATICEDGE) If $fenetrePrincipale <> 0 Then $inputValAchercher = GUICtrlCreateInput("", 20, 20, 200, 22) $bouttonRecherche = GUICtrlCreateButton("Chercher", 20, 50, 200, 25) $bouttonExit = GUICtrlCreateButton("Sortir", 20, 85, 200, 25) GUISetState(@SW_SHOW, $fenetrePrincipale) GUI_Life() Else MsgBox(0, "ERREUR", "impossible de créer la fenêtre") EndIf EndFunc Func GUI_Life() Local $eventsGUI ; here evrything is working usually good While 1 $eventsGUI = GUIGetMsg(1) Select Case $eventsGUI[0] = $GUI_EVENT_CLOSE If $eventsGUI[1] = $fenetrePrincipale Then ExitLoop ElseIf $eventsGUI[1] = $fenetreRapport Then GUIDelete($fenetreRapport) GUISwitch($fenetrePrincipale) EndIf Case $eventsGUI[0] = $bouttonExit ExitLoop Case $eventsGUI[0] = $bouttonRecherche GUICtrlSetState($inputValAchercher, $GUI_DISABLE) GUICtrlSetState($bouttonRecherche, $GUI_DISABLE) GUICtrlSetState($bouttonExit, $GUI_DISABLE) regCheck(GUICtrlRead($inputValAchercher)) ; execpt here when i ask to get event from the secondary windows directly ; in another hand the event GUI_EVENT_CLOSE (first case of this select) is working well Case $eventsGUI[0] = $menuSave MsgBox(0, "", "fhgdfhgjdfjk") EndSelect WEnd EndFunc Func regCheck($bibi) Global $fenetreRapport, $menuSave, $menuExit Local $tempa, $Treeview_4, $menu $fenetreRapport = GUICreate(".RaPPorT Kojak.", 1000, 725, -1, -1 , -1, -1, $fenetrePrincipale) $menu = GUICtrlCreateMenu(".&dA mENu.") $menuSave = GUICtrlCreateMenuitem("&sauvegarder", $menu) GUISetState(@SW_SHOW, $fenetreRapport) WinWait(".RaPPorT Kojak.") EndFunc oÝ÷ Ú'âr¦z{më)Þ²+p¢¹,jëh×6 Case $eventsGUI[0] = $menuSave MsgBox(0, "", "fhgdfhgjdfjk") Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 11, 2006 Share Posted August 11, 2006 It is when i call regCheck Function, i create another GUI CODE #include <GUIConstants.au3> #include <file.au3> #include <Array.au3> mMain() Func mMain() ; usually this windows is created and works well Global $fenetrePrincipale Global $inputValAchercher, $bouttonRecherche, $bouttonExit, $imageFond, $imageAttache $fenetrePrincipale = GUICreate(".RegChecK Papa.", 245, 130, 350, 350, $WS_CAPTION + $WS_SYSMENU + $WS_VISIBLE, $WS_EX_CONTEXTHELP + $WS_EX_STATICEDGE) If $fenetrePrincipale <> 0 Then $inputValAchercher = GUICtrlCreateInput("", 20, 20, 200, 22) $bouttonRecherche = GUICtrlCreateButton("Chercher", 20, 50, 200, 25) $bouttonExit = GUICtrlCreateButton("Sortir", 20, 85, 200, 25) GUISetState(@SW_SHOW, $fenetrePrincipale) GUI_Life() Else MsgBox(0, "ERREUR", "impossible de créer la fenêtre") EndIf EndFunc Func GUI_Life() Local $eventsGUI ; here evrything is working usually good While 1 $eventsGUI = GUIGetMsg(1) Select Case $eventsGUI[0] = $GUI_EVENT_CLOSE If $eventsGUI[1] = $fenetrePrincipale Then ExitLoop ElseIf $eventsGUI[1] = $fenetreRapport Then GUIDelete($fenetreRapport) GUISwitch($fenetrePrincipale) EndIf Case $eventsGUI[0] = $bouttonExit ExitLoop Case $eventsGUI[0] = $bouttonRecherche GUICtrlSetState($inputValAchercher, $GUI_DISABLE) GUICtrlSetState($bouttonRecherche, $GUI_DISABLE) GUICtrlSetState($bouttonExit, $GUI_DISABLE) regCheck(GUICtrlRead($inputValAchercher)) ; execpt here when i ask to get event from the secondary windows directly ; in another hand the event GUI_EVENT_CLOSE (first case of this select) is working well Case $eventsGUI[0] = $menuSave MsgBox(0, "", "fhgdfhgjdfjk") EndSelect WEnd EndFunc Func regCheck($bibi) Global $fenetreRapport, $menuSave, $menuExit Local $tempa, $Treeview_4, $menu $fenetreRapport = GUICreate(".RaPPorT Kojak.", 1000, 725, -1, -1 , -1, -1, $fenetrePrincipale) $menu = GUICtrlCreateMenu(".&dA mENu.") $menuSave = GUICtrlCreateMenuitem("&sauvegarder", $menu) GUISetState(@SW_SHOW, $fenetreRapport) WinWait(".RaPPorT Kojak.") EndFunc if i comment these lines it works : Case $eventsGUI[0] = $menuSave MsgBox(0, "", "fhgdfhgjdfjk") And you declard $menuSave as Global, too... hmmm... Seems like it should work, but I can't test right now. Maybe we'll get some Guru enlightenment soon. 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 SmOke_N Posted August 11, 2006 Moderators Share Posted August 11, 2006 Case $eventsGUI[0] = $menuSave And $eventsGUI[1] = $fenetrePrincipaleI'm lost in the code, couldn't run it without having to add stuff myself so lost intrest.... the above is just a stab, because I really don't know what you want to do with that messagebox. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
ddeerr Posted August 11, 2006 Author Share Posted August 11, 2006 Case $eventsGUI[0] = $menuSave And $eventsGUI[1] = $fenetrePrincipale i already tried that with no resust I'm lost in the code, couldn't run it without having to add stuff myself so lost intrest.... the above is just a stab, because I really don't know what you want to do with that messagebox. what i want ?! i justwant to know if is it possible to do that cause i will display result from queries in my programs and list them in a GuiList then create the save menu to save it to txt. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 11, 2006 Moderators Share Posted August 11, 2006 i already tried that with no resustwhat i want ?!i justwant to know if is it possible to do that cause i will display result from queries in my programs and list them in a GuiList then create the save menu to save it to txt.Possible to do "exactly" what? Forgive me if everyone else gets this, I've been up for some time, and may just be missing the boat here (shut up Gary). Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
ddeerr Posted August 11, 2006 Author Share Posted August 11, 2006 Possible to do "exactly" what? Forgive me if everyone else gets this, I've been up for some time, and may just be missing the boat here (shut up Gary). for the moment i test this simply maybe i'm too simple ?I test only how can it be possible to add and manage GUI beginning a basic one cause, i will do some programs and i would like to be able to create many windows in the same programs because i will implement "beautiful windows" like koda display. Link to comment Share on other sites More sharing options...
eltorro Posted August 12, 2006 Share Posted August 12, 2006 (edited) if i comment these lines it works : Case $eventsGUI[0] = $menuSave MsgBox(0, "", "fhgdfhgjdfjk")oÝ÷ Ûú®¢×êk¡¹^+-«tß©ä½ Cheers, eltorro Edited August 12, 2006 by eltorro Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
ddeerr Posted August 12, 2006 Author Share Posted August 12, 2006 The problem is that $menuSave = 0( because regCheck() hasn't been called yet or maybe deleted), which also happens to mean no message. I modified your script a little so that it will at least run for me. ****** indicate what I changed. expandcollapse popup#include <GUIConstants.au3> #include <file.au3> #include <Array.au3> ;******* moved these out of individual functions Global $fenetreRapport, $menuSave, $menuExit Global $fenetrePrincipale Global $inputValAchercher, $bouttonRecherche, $bouttonExit, $imageFond, $imageAttache mMain() Func mMain() ; usually this windows is created and works well $fenetrePrincipale = GUICreate(".RegChecK Papa.", 245, 130, 350, 350, $WS_CAPTION + $WS_SYSMENU + $WS_VISIBLE, $WS_EX_CONTEXTHELP + $WS_EX_STATICEDGE) If $fenetrePrincipale <> 0 Then $inputValAchercher = GUICtrlCreateInput("", 20, 20, 200, 22) $bouttonRecherche = GUICtrlCreateButton("Chercher", 20, 50, 200, 25) $bouttonExit = GUICtrlCreateButton("Sortir", 20, 85, 200, 25) GUISetState(@SW_SHOW, $fenetrePrincipale) GUI_Life() Else MsgBox(0, "ERREUR", "impossible de créer la fenêtre") EndIf EndFunc Func GUI_Life() Local $eventsGUI ; here evrything is working usually good While 1 $eventsGUI = GUIGetMsg(1) Select Case $eventsGUI[0] = $GUI_EVENT_CLOSE If $eventsGUI[1] = $fenetrePrincipale Then ExitLoop ElseIf $eventsGUI[1] = $fenetreRapport Then GUIDelete($fenetreRapport) GUISwitch($fenetrePrincipale) ;******* re-enable controls on main form. GUICtrlSetState($inputValAchercher, $GUI_ENABLE) GUICtrlSetState($bouttonRecherche, $GUI_ENABLE) GUICtrlSetState($bouttonExit, $GUI_ENABLE) EndIf Case $eventsGUI[0] = $bouttonExit ExitLoop Case $eventsGUI[0] = $bouttonRecherche GUICtrlSetState($inputValAchercher, $GUI_DISABLE) GUICtrlSetState($bouttonRecherche, $GUI_DISABLE) GUICtrlSetState($bouttonExit, $GUI_DISABLE) regCheck(GUICtrlRead($inputValAchercher)) Case $menuSave and ($eventsGUI[0] = $menuSave) ;******* workaround for control not declared MsgBox(0, "", "fhgdfhgjdfjk") EndSelect WEnd EndFunc Func regCheck($bibi) Local $tempa, $Treeview_4, $menu $fenetreRapport = GUICreate(".RaPPorT Kojak.", 1000, 725, -1, -1 , -1, -1, $fenetrePrincipale) $menu = GUICtrlCreateMenu(".&dA mENu.") $menuSave = GUICtrlCreateMenuitem("&sauvegarder", $menu) GUISetState(@SW_SHOW, $fenetreRapport) WinWait(".RaPPorT Kojak.") EndFunc Cheers, eltorro Magnific el Torro it works well like that I will not be able to find how to do to work this without you for sure may thanks 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