evilertoaster Posted June 27, 2006 Author Posted June 27, 2006 (edited) I wrote something that does this - but I have not updated the code in a while, so there is a lot of extra code that is not needed, but I think it might help. By the way if someone could knock it down and show me all the things that I did wrong - I would be greatful.Got a link to it?Edit: OOO i'm an 'advanced member' now i get another pretty star! Edited June 28, 2006 by evilertoaster
nitekram Posted June 28, 2006 Posted June 28, 2006 Got a link to it?Edit: OOO i'm an 'advanced member' now i get another pretty star!no but if you tell me where to put it I will put it there 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
kcd-clan Posted June 28, 2006 Posted June 28, 2006 muhahahaha i did it:P It was freaking hard but i did it. the exit buttion dont work but i can fix that if needed. I know its not exzacttly what you want but studdy it and you will find what you need. expandcollapse popup$pause=0 $gui=1 #include <GUIConstants.au3> ;make GUI1 $GUI1=GUICreate("GUI1") $pause=GUICtrlCreateButton("pause", 50, 50) ;Make GUI2 $GUI2 = GUICreate("GUI2") $button2=GUICtrlCreateButton("button2", 50, 50) ;Show GUI1 GUIsetstate(@SW_SHOW,$GUI1) ;Wait around While 1 $msg = GuiGetMsg() Select Case $msg = $pause $pause=1 GUISetState(@SW_SHOW,$GUI2) pause() Case $msg = $Button2 action2() Case $msg = $GUI_EVENT_CLOSE If $gui=1 Then ExitLoop EndIf If $gui=2 Then GUIsetstate(@SW_HIDE,$GUI2) $gui=1 EndIf Case Else ;;;;;;; EndSelect WEnd func action2 () MsgBox(0,"OK","You pressed button2") endfunc Func pause() If $pause =1 Then GUIDelete ( $gui1 ) $GUI1=GUICreate("GUI1") $pause=GUICtrlCreateButton("UNpause", 50, 50) GUISetState(@SW_SHOW,$GUI1) Do While 1 $msg = GuiGetMsg() Select Case $msg = $pause $pause=0 pause() Case $msg = $Button2 action2() Case $msg = $GUI_EVENT_CLOSE If $gui=1 Then ExitLoop EndIf If $gui=2 Then GUIsetstate(@SW_HIDE,$GUI2) $gui=1 EndIf Case Else ;;;;;;; EndSelect WEnd Until $pause=0 EndIf If $pause =0 Then GUIDelete ( $gui1 ) $GUI1=GUICreate("GUI1") $pause=GUICtrlCreateButton("pause", 50, 50) GUISetState(@SW_SHOW,$GUI1) While 1 $msg = GuiGetMsg() Select Case $msg = $pause $pause=1 GUISetState(@SW_SHOW,$GUI2) pause() Case $msg = $Button2 action2() Case $msg = $GUI_EVENT_CLOSE If $gui=1 Then ExitLoop EndIf If $gui=2 Then GUIsetstate(@SW_HIDE,$GUI2) $gui=1 EndIf Case Else ;;;;;;; EndSelect WEnd EndIf EndFunc Visit mEMy programs made.Iul - IulG-V Console - G-V Console_RandomLetter - _RandomLetter()Saftey Kill - Saftey Killcolorzone() = colorzone()
greenmachine Posted June 28, 2006 Posted June 28, 2006 #include <GUIConstants.au3> opt ("GUIOnEventMode",1) ;make GUI1 $GUI1=GUICreate("GUI1") $button1=GUICtrlCreateButton("button1", 50, 50) GUICtrlSetOnEvent($button1, "action1") ;Make GUI2 $GUI2 = GUICreate("GUI2") $button2=GUICtrlCreateButton("button2", 50, 50) GUICtrlSetOnEvent($button2,"action2") GUISetOnEvent ($GUI_EVENT_CLOSE, "timetogo") GUIsetstate(@SW_SHOW,$GUI1) While 1 sleep (1000) WEnd func action1 () GUISetState(@SW_SHOW,$GUI2) endfunc func action2 () MsgBox(0,"OK","You pressed button2") endfunc Func timetogo() Exit EndFunc When you use GUIOnEventMode, it doesn't respond while inside functions (not sure why). Since all you're doing is sleeping inside the function, just let it return to the global sleep.
nitekram Posted June 28, 2006 Posted June 28, 2006 (edited) muhahahaha i did it:PIt was freaking hard but i did it.the exit buttion dont work but i can fix that if needed.I know its not exzacttly what you want but studdy it and you will find what you need.mine works with opt("GUIONEVENTMODE",1) - i thought that is what was wanted?edit - greenmachine - i wanted to post my code Edited June 28, 2006 by nitekram 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
kcd-clan Posted June 28, 2006 Posted June 28, 2006 Im not really fimilar with that. It would take me a day to do it taht way. I could try if he needs it but this is a shur way. Visit mEMy programs made.Iul - IulG-V Console - G-V Console_RandomLetter - _RandomLetter()Saftey Kill - Saftey Killcolorzone() = colorzone()
nitekram Posted June 28, 2006 Posted June 28, 2006 I found a way to upload it Anyway like I said please tear it apart and give me some ideas on how I can to make is shorter. 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
kcd-clan Posted June 28, 2006 Posted June 28, 2006 If you want to email me the script then i can see waht i can do. If you do the on guid even you cant use exit buttion. It could still work tho. il pm you Visit mEMy programs made.Iul - IulG-V Console - G-V Console_RandomLetter - _RandomLetter()Saftey Kill - Saftey Killcolorzone() = colorzone()
Nomad Posted June 28, 2006 Posted June 28, 2006 (edited) Im not really fimilar with that. It would take me a day to do it taht way. I could try if he needs it but this is a shur way. So I guess you can have more than 1 parent, I guess I learned something today. Here is your script with a few other GUIEventMode functions: expandcollapse popup#include <GUIConstants.au3> Global $a, $b Opt("GUIONEVENTMODE",1) $a = GUICreate("Test") GUICtrlCreateButton("but1",15,15) GUICtrlSetOnEvent(-1,"f1") GUISetState() GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate", $a) GUISetOnEvent($GUI_EVENT_MINIMIZE, "Minimize", $a) While 1 Sleep(100) WEnd Func f1() $b = GUICreate("Test2",135,135) GUICtrlCreateButton("but2",5,5) GUICtrlSetOnEvent(-1,"f2") GUISetState() GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate2", $B) GUISetOnEvent($GUI_EVENT_MINIMIZE, "Minimize2", $B) EndFunc Func f2() MsgBox(0,"OK","OK") EndFunc Func Minimize () GUISetState(@SW_MINIMIZE, $a) EndFunc Func Terminate () Exit EndFunc Func Minimize2 () GUISetState(@SW_MINIMIZE, $B) EndFunc Func Terminate2 () GUIDelete($B) EndFunc I think you can take it from here. Edited June 28, 2006 by Nomad
nitekram Posted June 28, 2006 Posted June 28, 2006 I found a way to upload it Anyway like I said please tear it apart and give me some ideas on how I can to make is shorter.EDIT - By the way only parts of it work, but I believe it all does work - just missing things to put in. 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
evilertoaster Posted June 28, 2006 Author Posted June 28, 2006 This works: opt("GUIONEVENTMODE",1) $a = GUICreate("Test") GUICtrlCreateButton("but1",15,15) GUICtrlSetOnEvent(-1,"f1") $b = GUICreate("Test2",135,135,5,5,-1,"",$a) GUICtrlCreateButton("but2",5,5) GUICtrlSetOnEvent(-1,"f2") GUISetState(@SW_SHOW, $a) While 1 Sleep(100) WEnd func f1() GUISetState(@SW_SHOW, $B) EndFunc func f2() MsgBox(0,"OK","OK"); Still not called.... EndFuncYes but look at my other post(with the psquedo code), I can't really return from the function yet becuase i got more code to run after i show the GUI2
evilertoaster Posted June 28, 2006 Author Posted June 28, 2006 muhahahaha i did it:P It was freaking hard but i did it. the exit buttion dont work but i can fix that if needed. I know its not exzacttly what you want but studdy it and you will find what you need. expandcollapse popup$pause=0 $gui=1 #include <GUIConstants.au3> ;make GUI1 $GUI1=GUICreate("GUI1") $pause=GUICtrlCreateButton("pause", 50, 50) ;Make GUI2 $GUI2 = GUICreate("GUI2") $button2=GUICtrlCreateButton("button2", 50, 50) ;Show GUI1 GUIsetstate(@SW_SHOW,$GUI1) ;Wait around While 1 $msg = GuiGetMsg() Select Case $msg = $pause $pause=1 GUISetState(@SW_SHOW,$GUI2) pause() Case $msg = $Button2 action2() Case $msg = $GUI_EVENT_CLOSE If $gui=1 Then ExitLoop EndIf If $gui=2 Then GUIsetstate(@SW_HIDE,$GUI2) $gui=1 EndIf Case Else ;;;;;;; EndSelect WEnd func action2 () MsgBox(0,"OK","You pressed button2") endfunc Func pause() If $pause =1 Then GUIDelete ( $gui1 ) $GUI1=GUICreate("GUI1") $pause=GUICtrlCreateButton("UNpause", 50, 50) GUISetState(@SW_SHOW,$GUI1) Do While 1 $msg = GuiGetMsg() Select Case $msg = $pause $pause=0 pause() Case $msg = $Button2 action2() Case $msg = $GUI_EVENT_CLOSE If $gui=1 Then ExitLoop EndIf If $gui=2 Then GUIsetstate(@SW_HIDE,$GUI2) $gui=1 EndIf Case Else ;;;;;;; EndSelect WEnd Until $pause=0 EndIf If $pause =0 Then GUIDelete ( $gui1 ) $GUI1=GUICreate("GUI1") $pause=GUICtrlCreateButton("pause", 50, 50) GUISetState(@SW_SHOW,$GUI1) While 1 $msg = GuiGetMsg() Select Case $msg = $pause $pause=1 GUISetState(@SW_SHOW,$GUI2) pause() Case $msg = $Button2 action2() Case $msg = $GUI_EVENT_CLOSE If $gui=1 Then ExitLoop EndIf If $gui=2 Then GUIsetstate(@SW_HIDE,$GUI2) $gui=1 EndIf Case Else ;;;;;;; EndSelect WEnd EndIf EndFunc hummm yea i think this could work..i'll have to retro fit it for the other GUI event mode....
evilertoaster Posted June 28, 2006 Author Posted June 28, 2006 When you use GUIOnEventMode, it doesn't respond while inside functions (not sure why). Since all you're doing is sleeping inside the function, just let it return to the global sleep.Yes but like i posted above, im not just sleeping in the real thing
evilertoaster Posted June 28, 2006 Author Posted June 28, 2006 Ok so reading everyones response i guess there's no easy was to do this... i already have alot of GUI structure in place and i didnt' realize that this would be a problem... So im guessing some sort of massive restructuring is in order for my script (yay ) @kcd-clan - thanks for the offer ill try and contact you
livewire Posted June 28, 2006 Posted June 28, 2006 (edited) You can use an ActiveX control and it works fine...I tried it...see here. Problem is you would have to register the ActiveX control. If you need this functionality immediately you can use this for the time being.-Livewire Edited June 28, 2006 by livewire
evilertoaster Posted June 28, 2006 Author Posted June 28, 2006 Hummm, could you maybe give some sort of example on making an activeX control a GUIButton? this link seems to be a regserv.exe scripter....which is cool but not exactly what im looking for i think...
livewire Posted June 28, 2006 Posted June 28, 2006 (edited) Go here to get ActiveX controls. Register the control, then run this script.#include <GUIConstants.au3> opt ("Guioneventmode",1) ;make GUI1 $GUI1=GUICreate("GUI1") $button1=GUICtrlCreateButton("button1", 50, 50) GUICtrlSetOnEvent($button1, "action1") ;Make GUI2 $GUI2 = GUICreate("GUI2") $Button2 = ObjCreate("VBControls.CommandButton") GUICtrlCreateObj($Button2, 50, 50, 100, 30) ObjEvent($Button2,"Button2_") $Button2.SetCaption("Button2") ;Show GUI1 GUIsetstate(@SW_SHOW,$GUI1) ;Wait around While 1 sleep (1000) WEnd ;Button1 is pressed... func action1 () ;show GUI2 then wait around GUISetState(@SW_SHOW,$GUI2) while 1 sleep (1000) ;From here, it would be nice for action 2 to be able to be called when pressing button2 without having to finish action1... WEnd endfunc Func Button2_Click() MsgBox(0,"OK","You pressed button2") EndFunc Edited June 28, 2006 by livewire
evilertoaster Posted June 28, 2006 Author Posted June 28, 2006 hum yes thats an interesting way of doing it. The end result seems to be exactly what i need, quick question- can you make XP-styled buttons or only classic (square) styled ones? It looks like then that OBJ and HotKey events can redirect program flow even from within a GUI event...i wish GUI events could do it themselfs
livewire Posted June 28, 2006 Posted June 28, 2006 Yes, you can make XP-styled buttons. I set the "Graphical" attribute of the button, so that I could change the background color.
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