GodForsakenSoul Posted December 22, 2009 Share Posted December 22, 2009 i'm having an interesting (IMHO) problem. i made a back button. Case $msgkan=$buttonkb GUIMAINGUI() ExitLoop the button works nicely ON THE FIRST TIME. when i call the function with these lines again, it immediately exits the loop. what the heck is going on?! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 22, 2009 Moderators Share Posted December 22, 2009 GodForsakenSoul , Need a bit more than that to offer any assistance. 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...
GodForsakenSoul Posted December 22, 2009 Author Share Posted December 22, 2009 (edited) due to fact it's YOU, i made you a video recording of the issue. the second time i press practice kana it exits =/ edit: here's the pressing order F5 Practice kana Back Practice kana AND IT EXITS WHEN IT SHOULDN'T!!! Edited December 22, 2009 by GodForsakenSoul Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 22, 2009 Moderators Share Posted December 22, 2009 GodForsakenSoul, I believed you before I saw the video, but I still need to see the code if I am to help. M23 P.S. Why YouTube specially for me? 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...
Bert Posted December 22, 2009 Share Posted December 22, 2009 (edited) Unless we can see the code, we can't help. Edited December 22, 2009 by Volly The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
GodForsakenSoul Posted December 22, 2009 Author Share Posted December 22, 2009 GodForsakenSoul,I believed you before I saw the video, but I still need to see the code if I am to help. M23P.S. Why YouTube specially for me?do you want the entire file or is just the function allright?there is no need for the main file as it just calls the function when the button is pressed so... yeah.from what i see, you like things to be explain thoroughly. couldn't find a more thorough explanation then youtube Link to comment Share on other sites More sharing options...
Bert Posted December 22, 2009 Share Posted December 22, 2009 Just post your script so we can see what the problem is. If you are concerned on what is in the script, PM us and that way the noobs won't get ahold of it. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 22, 2009 Moderators Share Posted December 22, 2009 GodForsakenSoul, You explained the problem perfectly well, but without your code I cannot begin to help you find out what is wrong. Post the whole thing, or PM it as Volly suggested. 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...
GodForsakenSoul Posted December 22, 2009 Author Share Posted December 22, 2009 expandcollapse popup#include "Include\GUIConstants.au3" Func GUIMAINGUI() GUICreate("Basic Japanes Training",550,250) Opt("GuiCoordMode", 0) $button1=GUICtrlCreateButton("Practice Conjugation", 20,20,200,20,$BS_CENTER) $Button2=GUICtrlCreateButton("Practice Kana", 0,20,200,20,$BS_CENTER) $button3=GUICtrlCreateButton("Options",0,20,200,20,$BS_CENTER) $button4=GUICtrlCreateButton("Exit",0,100,200,20,$BS_CENTER) GUISetState() while 1=1 $msg=GUIGetMsg() Select Case $msg=$button1 IniWrite("Data\OPT.INI", "MAINGUI", "BUTTON", "1") Sleep(10) ExitLoop Case $msg=$Button2 IniWrite("Data\OPT.INI", "MAINGUI", "BUTTON", "2") Sleep(10) ExitLoop Case $msg=$button3 IniWrite("Data\OPT.INI", "MAINGUI", "BUTTON", "3") Sleep(10) ExitLoop Case $msg=$button4 IniWrite("Data\OPT.INI", "MAINGUI", "BUTTON", "4") Sleep(10) ExitLoop case $msg=$GUI_EVENT_CLOSE ExitLoop EndSelect WEnd EndFunc Func GUIPCON() GUICreate("Basic Japanese Training: Conjugation", 250, 200) Opt("GuiCoordMode",0) GUISetState() EndFunc Func GUIPKAN() GUICreate("Basic Japanese Training: Kana parctice", 250,250) Opt("GuiCoordMode",0) GUIStartGroup() $radiok1=GUICtrlCreateRadio("Hiragana only",20,20,150,15) $radiok2=GUICtrlCreateRadio("Katakana only",0,20,150,15) $radiok3=GUICtrlCreateRadio("Hiragana and katakana",0,20,150,15) GUIStartGroup() $labelk1=GUICtrlCreateLabel("Insert number of letters for training",10,20,100,50) $inputk1=GUICtrlCreateInput("",0,50,100,20) $buttonk1=GUICtrlCreateButton("Begin Training",10,20,80,20) $buttonkb=GUICtrlCreateButton("Back",0,20,150,20) GUISetState() while 1=1 $msgkan=GUIGetMsg() Select Case $msgkan=$buttonk1 $inputk1r=GUICtrlRead($inputk1) IniWrite("Data\OPT.INI","TRAINING","LOOPSNUMBER",$inputk1r) ; GUIPKANSELECT() ExitLoop Case $msgkan=$buttonkb GUIMAINGUI() ExitLoop Case $msgkan=$GUI_EVENT_CLOSE ExitLoop EndSelect WEnd EndFunc ;Func GUIPKANSTART() ; GUICreate("Basic Japanese Trainig: Kana Practice", ;EndFunc Func GUIOPT() GUICreate("Basic Japanese Training: Options", 550, 250) GUICtrlCreateLabel("Kana training options",20,20,150,20) $chkboxo1=GUICtrlCreateCheckbox("Show Images in Kana training",0,20,200,20) Opt("GuiCoordMode",0) GuiSetState() while 1=1 $msgopt=GUIGetMsg() Select Case $msgopt=$GUI_EVENT_CLOSE ExitLoop EndSelect WEnd EndFunc here's the entire file. the problem lies (i think) in GUIPKAN(). there's a bunch of unfinished functions but they don't matter. there is also a main file, but it simply reads a ini file with options, and calls the functions according to the options in it. like a large if thingy if you will. Link to comment Share on other sites More sharing options...
Bert Posted December 22, 2009 Share Posted December 22, 2009 OK, a few things I would do to make it easier: First, I would have all the controls linked to ONE while loop. Second - Use GUISetState to turn on and off the GUIs you are interacting with. Third - You may want to look in either using tabs, or hiding controls when you do not need them. I can help you fix it if you like, but I will need to see the entire thing to do it. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 22, 2009 Moderators Share Posted December 22, 2009 GodForsakenSoul ,This bit concerns me:Case $msgkan=$buttonkb GUIMAINGUI() ExitLoopWith this you are calling the GUIMAINGUI() function as you go "Back" from the GUIPKAN() function. Is this what you want to do? Should you not go back to the "main file" - the one where you press F5 to get to GUIPKAN() ?I would like to see the main file as well, please. I am also concerned with your GUIMAINGUI() function. You create a GUI, but never delete it - not good practice. You should either create the GUI elsewhere and then Hide/Show it as needed, or delete it as you leave the function. Otherwise you create a new GUI each time you call the function and will, eventually, run out of resources. Could I suggest adding something like this:; Store the handle of the GUI $hGUI = GUICreate("Basic Japanes Training",550,250) ; and then make the end of the function read EndSelect WEnd GUIDelete($hGUI) ; Add this line EndFuncNow your GUI is deleted as you leave, freeing up the resources. Looking forward to the next instalment. 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...
Bert Posted December 22, 2009 Share Posted December 22, 2009 Also, what version of AutoIt are you using? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
GodForsakenSoul Posted December 22, 2009 Author Share Posted December 22, 2009 ;main file as it currently exists #include "Data\GUIMainGui.au3" $file = FileOpen("Data\OPT.ini", 1) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf GUIMAINGUI() $OPT=IniRead("Data\OPT.ini", "MAINGUI", "BUTTON", "-1") Select Case $OPT=1 GUIPCON() Case $OPT=2 GUIPKAN() Case $opt=3 GUIOPT() Case $OPT=4 Exit EndSelect @M32: now here's a silly concern of mine: if i delete, will i get it back next time i call GUIMAINGUI()? that is exactly what i want to do. i want it to go back to GUIMAINGUI() rather then the main file because... frankly, i'm not sure how i'd use the main file. if using the main file, however, is inevitable, i'm sure i'll come up with something. @Volly: I have absolutely no clue (atm) how to use your first idea, nor the third. i'm using scite 1.75. i'm not sure on the autoit version, but it's the newest i found at the time. less then 2 years i think... #include "" is basically because i copied all the files from the include folder to @scriptdir\Data\Include to make the thing portable. Link to comment Share on other sites More sharing options...
Bert Posted December 22, 2009 Share Posted December 22, 2009 Try this: expandcollapse popup#include <GUIConstants.au3> #include <ButtonConstants.au3> Opt("GuiCoordMode",0) DIM $gui1, $gui2, $gui3, $gui4, $button1, $button2, $button3, $button4 DIM $radiok1, $radiok2, $radiok3 DIM $labelk1, $inputk1, $buttonk1, $buttonkb DIM $chkboxo1 _GUIMAINGUI() GUIPKAN() GUIPCON() GUIOPT() GUISetState(@SW_HIDE,$gui2) GUISetState(@SW_HIDE,$gui3) GUISetState(@SW_HIDE,$gui4) _whileloop() Func _whileloop() while 1 $msg=GUIGetMsg() Select case $msg=$GUI_EVENT_CLOSE $x = 1 if WinActive($gui1) and $x = 1 then ExitLoop endif if WinActive($gui2) then GUISetState(@SW_HIDE,$gui2) GUISetState(@SW_SHOW,$gui1) $x = 0 endif if WinActive($gui3) then GUISetState(@SW_HIDE,$gui3) GUISetState(@SW_SHOW,$gui1) $x = 0 endif if WinActive($gui4) then GUISetState(@SW_HIDE,$gui4) GUISetState(@SW_SHOW,$gui1) $x = 0 endif Case $msg = $button1 IniWrite("Data\OPT.INI", "MAINGUI", "BUTTON", "1") GUISetState(@SW_HIDE,$gui1) GUIPCON() Case $msg = $Button2 IniWrite("Data\OPT.INI", "MAINGUI", "BUTTON", "2") GUISetState(@SW_HIDE,$gui1) GUIPKAN() Case $msg = $button3 IniWrite("Data\OPT.INI", "MAINGUI", "BUTTON", "3") GUISetState(@SW_HIDE,$gui1) GUIOPT() Case $msg = $button4 IniWrite("Data\OPT.INI", "MAINGUI", "BUTTON", "4") exitloop Case $msg = $buttonk1 $inputk1r= GUICtrlRead($inputk1) IniWrite("Data\OPT.INI","TRAINING","LOOPSNUMBER",$inputk1r) msgbox(0, "", "Begin your training") ; GUIPKANSELECT() Case $msg=$buttonkb GUISetState(@SW_HIDE,$gui2) GUISetState(@SW_SHOW,$gui1) Case $msg = $chkboxo1 msgbox(0, "", "you either checked or unchecked this box") EndSelect WEnd EndFunc Func _GUIMAINGUI() $gui1 = GUICreate("Basic Japanes Training",550,250) Opt("GuiCoordMode", 0) $button1=GUICtrlCreateButton("Practice Conjugation", 20,20,200,20,$BS_CENTER) $Button2=GUICtrlCreateButton("Practice Kana", 0,20,200,20,$BS_CENTER) $button3=GUICtrlCreateButton("Options",0,20,200,20,$BS_CENTER) $button4=GUICtrlCreateButton("Exit",0,100,200,20,$BS_CENTER) GUISetState(@SW_SHOW,$gui1) EndFunc Func GUIPKAN() $gui2 = GUICreate("Basic Japanese Training: Kana parctice", 250,250) Opt("GuiCoordMode",0) GUIStartGroup() $radiok1=GUICtrlCreateRadio("Hiragana only",20,20,150,15) $radiok2=GUICtrlCreateRadio("Katakana only",0,20,150,15) $radiok3=GUICtrlCreateRadio("Hiragana and katakana",0,20,150,15) GUIStartGroup() $labelk1=GUICtrlCreateLabel("Insert number of letters for training",10,20,100,50) $inputk1=GUICtrlCreateInput("",0,50,100,20) $buttonk1=GUICtrlCreateButton("Begin Training",10,20,80,20) $buttonkb=GUICtrlCreateButton("Back",0,20,150,20) GUISetState(@SW_SHOW,$gui2) EndFunc Func GUIPCON() $gui3 = GUICreate("Basic Japanese Training: Conjugation", 250, 200) Opt("GuiCoordMode",0) GUISetState(@SW_SHOW,$gui3) EndFunc ;Func GUIPKANSTART() ; GUICreate("Basic Japanese Trainig: Kana Practice", ;EndFunc Func GUIOPT() $gui4 = GUICreate("Basic Japanese Training: Options", 550, 250) GUICtrlCreateLabel("Kana training options",20,20,150,20) $chkboxo1=GUICtrlCreateCheckbox("Show Images in Kana training",0,20,200,20) GUISetState(@SW_SHOW,$gui4) EndFunc The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted December 22, 2009 Share Posted December 22, 2009 i'm using scite 1.75. i'm not sure on the autoit version, but it's the newest i found at the time. less then 2 years i think... Checking your AutoIt version is easy: MsgBox(262208, "AutoIt version is:", @AutoItVersion) Or open the helpfile and read the version there. Or the version on AutoIt.exe .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface 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