BJJ Posted January 16, 2009 Share Posted January 16, 2009 Hi My next problem i dont know why that not work expandcollapse popupLocal $nMsg , $BackButton_all $Form1 = GUICreate("Form1", 340, 557, 387, 236) $Button1 = GUICtrlCreateButton("Button1", 16, 16, 121, 17, 0) $Button2 = GUICtrlCreateButton("Button2", 16, 40, 121, 17, 0) $Button3 = GUICtrlCreateButton("Button3", 16, 64, 121, 17, 0) GUISetState() While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE GUIDelete() Exit case $nMsg = $Button1 $Form2 = GUICreate("Form1", 258, 274, 351, 323) $BackButton1 = GUICtrlCreateButton("back", 192, 240, 57, 25, 0) GUISetState() case $nMsg = $Button2 $Form3 = GUICreate("Form1", 258, 274, 351, 323) $BackButton2 = GUICtrlCreateButton("back", 192, 240, 57, 25, 0) GUISetState() case $nMsg = $Button3 $Form4 = GUICreate("Form1", 258, 274, 351, 323) $BackButton3 = GUICtrlCreateButton("back", 192, 240, 57, 25, 0) GUISetState() $BackButton_all = $BackButton1 or $BackButton2 or $BackButton3 While 2 $nMsg = GUIGetMsg() select case $nMsg = $GUI_EVENT_CLOSE GUIDelete() Exit case $nMsg = $BackButton_all GUISetState(@SW_HIDE) ExitLoop EndSelect WEnd Exit Link to comment Share on other sites More sharing options...
Aceguy Posted January 16, 2009 Share Posted January 16, 2009 you are not closing off the while1 with wend for every while you NEED a wend [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
BJJ Posted January 17, 2009 Author Share Posted January 17, 2009 I add this but stil dont work BackButtons :/ expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <Array.au3> #include <StaticConstants.au3> #Include <File.au3> #include <ComboConstants.au3> #include <GUIListBox.au3> Local $nMsg , $BackButton_all $Form1 = GUICreate("Form1", 340, 557, 387, 236) $Button1 = GUICtrlCreateButton("Button1", 16, 16, 121, 17, 0) $Button2 = GUICtrlCreateButton("Button2", 16, 40, 121, 17, 0) $Button3 = GUICtrlCreateButton("Button3", 16, 64, 121, 17, 0) GUISetState() While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE GUIDelete() Exit case $nMsg = $Button1 $Form2 = GUICreate("Form1", 258, 274, 351, 323) $BackButton1 = GUICtrlCreateButton("back", 192, 240, 57, 25, 0) GUISetState() case $nMsg = $Button2 $Form3 = GUICreate("Form1", 258, 274, 351, 323) $BackButton2 = GUICtrlCreateButton("back", 192, 240, 57, 25, 0) GUISetState() case $nMsg = $Button3 $Form4 = GUICreate("Form1", 258, 274, 351, 323) $BackButton3 = GUICtrlCreateButton("back", 192, 240, 57, 25, 0) GUISetState() EndSelect WEnd $BackButton_all = $BackButton1 or $BackButton2 or $BackButton3 While 2 $nMsg = GUIGetMsg() select case $nMsg = $GUI_EVENT_CLOSE GUIDelete() Exit case $nMsg = $BackButton_all GUISetState(@SW_HIDE) ExitLoop EndSelect WEnd Exit Link to comment Share on other sites More sharing options...
Developers Jos Posted January 17, 2009 Developers Share Posted January 17, 2009 (edited) What is this section supposed to do? $BackButton_all = $BackButton1 Or $BackButton2 Or $BackButton3 While 2 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE GUIDelete() Exit Case $nMsg = $BackButton_all GUISetState(@SW_HIDE) ExitLoop EndSelect WEnd Also, the first line doesn't make any sence to me. Jos Edited January 17, 2009 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
BJJ Posted January 17, 2009 Author Share Posted January 17, 2009 any gui have button close this while make when you click on close button gui be close and back to program window Link to comment Share on other sites More sharing options...
Developers Jos Posted January 17, 2009 Developers Share Posted January 17, 2009 any gui have button close this while make when you click on close button gui be close and back to program windownot sure what you are trying to tell me here, but the second while will never ever be executed. Also, as mentioned, this line does not make any sence: $BackButton_all = $BackButton1 Or $BackButton2 Or $BackButton3 You need to put all you GUI logic within the first Whille-Wend loop. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
torels Posted January 17, 2009 Share Posted January 17, 2009 just add the statements in the while 1 loop take a look at guigetmsg and other gui functions in the helpfile Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org Link to comment Share on other sites More sharing options...
BJJ Posted January 17, 2009 Author Share Posted January 17, 2009 eh i try but stil my cod be wrong expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <Array.au3> #include <StaticConstants.au3> #Include <File.au3> #include <ComboConstants.au3> #include <GUIListBox.au3> Local $nMsg , $BackButton_all $Form1 = GUICreate("Form1", 340, 557, 387, 236) $Button1 = GUICtrlCreateButton("Button1", 16, 16, 121, 17, 0) $Button2 = GUICtrlCreateButton("Button2", 16, 40, 121, 17, 0) $Button3 = GUICtrlCreateButton("Button3", 16, 64, 121, 17, 0) GUISetState() While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE GUIDelete() Exit case $nMsg = $Button1 $Form2 = GUICreate("Form1", 258, 274, 351, 323) $BackButton1 = GUICtrlCreateButton("back", 192, 240, 57, 25, 0) GUISetState() case $nMsg = $Button2 $Form3 = GUICreate("Form1", 258, 274, 351, 323) $BackButton2 = GUICtrlCreateButton("back", 192, 240, 57, 25, 0) GUISetState() case $nMsg = $Button3 $Form4 = GUICreate("Form1", 258, 274, 351, 323) $BackButton3 = GUICtrlCreateButton("back", 192, 240, 57, 25, 0) GUISetState() case $nMsg = $BackButton1 GUISetState(@SW_HIDE) EndSelect WEnd Exit Link to comment Share on other sites More sharing options...
Developers Jos Posted January 17, 2009 Developers Share Posted January 17, 2009 I can see that it is wrong.... what are you trying to do when creating the new GUI's after a button is clicked? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
BJJ Posted January 17, 2009 Author Share Posted January 17, 2009 when u click on button 1 , 2 or 3 program make new gui there is backbutton when you click gui close and while back to previous gui Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 17, 2009 Moderators Share Posted January 17, 2009 Quzziy, Hi again. This is a simple example of what I think you are looking for:#include <GUIConstantsEx.au3> Global $nMsg, $Form2 = 9999, $BackButton2 = 9999 $Form1 = GUICreate("Form1", 340, 557, 387, 236) $Button1 = GUICtrlCreateButton("Button1", 16, 16, 121, 17, 0) GUISetState() While 1 $aMsg = GUIGetMsg(1) Select Case $aMsg[0] = $GUI_EVENT_CLOSE And $aMsg[1] = $Form1 GUIDelete($Form1) Exit Case $aMsg[0] = $GUI_EVENT_CLOSE And $aMsg[1] = $Form2 GUIDelete($Form2) Case $aMsg[0] = $Button1 If Not WinExists("Form2", "") Then $Form2 = GUICreate("Form2", 258, 274, 351, 323) $BackButton2 = GUICtrlCreateButton("Back", 192, 240, 57, 25, 0) EndIf GUISetState(@SW_SHOW, $Form2) Case $aMsg[0] = $BackButton2 GUISetState(@SW_HIDE, $Form2) EndSelect WEnd Two things to note: 1. You have to declare the $Form2 and $BackButton2 variables with some value or else the Select Case has nothing to compare. You cannot leave them at 0 as that is the "nothing happening" return from GUIGetMsg. You need to use a high number so that it is very unlikely to correspond with a valid control. 2. The use of GUIGetMsg(1) which returns an array so you can determine which window is responding (look in the Help file for details). Otherwise clicking the [X] on Form2 will exit the whole script - try using just GUIGetMsg() and see what happens..... Enjoy your time with the dictionary (private joke!), 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...
BJJ Posted January 17, 2009 Author Share Posted January 17, 2009 (edited) expandcollapse popup#include <GUIConstantsEx.au3> Global $nMsg, $Form2 = 9999, $Form3 = 9999 , $BackButton2 = 9999 , $BackButton3 = 9999 $Form1 = GUICreate("Form1", 340, 557, 387, 236) $Button1 = GUICtrlCreateButton("Button1", 16, 16, 121, 17, 0) $Button2 = GUICtrlCreateButton("Button2", 16, 40, 121, 17, 0) GUISetState() While 1 $aMsg = GUIGetMsg(1) Select Case $aMsg[0] = $GUI_EVENT_CLOSE And $aMsg[1] = $Form1 GUIDelete($Form1) Exit Case $aMsg[0] = $GUI_EVENT_CLOSE And $aMsg[1] = $Form2 GUIDelete($Form2) Case $aMsg[0] = $Button1 If Not WinExists("Form2", "") Then $Form2 = GUICreate("Form2", 258, 274, 351, 323) $BackButton2 = GUICtrlCreateButton("Back", 192, 240, 57, 25, 0) EndIf GUISetState(@SW_SHOW, $Form2) Case $aMsg[0] = $Button2 If Not WinExists("Form3", "") Then $Form3 = GUICreate("Form3", 258, 274, 351, 323) $BackButton3 = GUICtrlCreateButton("Back", 192, 240, 57, 25, 0) EndIf GUISetState(@SW_SHOW, $Form3) Case $aMsg[0] = $BackButton3 GUISetState(@SW_HIDE, $Form3) Case $aMsg[0] = $BackButton2 GUISetState(@SW_HIDE, $Form2) EndSelect WEnd Thats work good but if i want make 30 button't that dont be look good and i dont understand why i must put " =9999" after variable in past program i dont use this and all work greate Edited January 17, 2009 by Quzziy Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 17, 2009 Moderators Share Posted January 17, 2009 Quzziy,Check your code for the second GUI carefully - you have 2 errors in that section:1. If Not WinExists("Form", "") should read If Not WinExists("Form3", "")2. GUISetState(@SW_SHOW, $Form2) should read GUISetState(@SW_SHOW, $Form3)You should also add another $GUI_EVENT_CLOSE case for Form3:expandcollapse popup#include <GUIConstantsEx.au3> Global $nMsg, $Form2 = 9999, $Form3 = 9999 , $BackButton2 = 9999 , $BackButton3 = 9999 $Form1 = GUICreate("Form1", 340, 557, 387, 236) $Button1 = GUICtrlCreateButton("Button1", 16, 16, 121, 17, 0) $Button2 = GUICtrlCreateButton("Button2", 16, 40, 121, 17, 0) GUISetState() While 1 $aMsg = GUIGetMsg(1) Select Case $aMsg[0] = $GUI_EVENT_CLOSE And $aMsg[1] = $Form1 GUIDelete($Form1) Exit Case $aMsg[0] = $GUI_EVENT_CLOSE And $aMsg[1] = $Form2 GUIDelete($Form2) Case $aMsg[0] = $GUI_EVENT_CLOSE And $aMsg[1] = $Form3 GUIDelete($Form3) Case $aMsg[0] = $Button1 If Not WinExists("Form2", "") Then $Form2 = GUICreate("Form2", 258, 274, 351, 323) $BackButton2 = GUICtrlCreateButton("Back", 192, 240, 57, 25, 0) EndIf GUISetState(@SW_SHOW, $Form2) Case $aMsg[0] = $Button2 If Not WinExists("Form3", "") Then $Form3 = GUICreate("Form3", 258, 274, 351, 323) $BackButton3 = GUICtrlCreateButton("Back", 192, 240, 57, 25, 0) EndIf GUISetState(@SW_SHOW, $Form3) Case $aMsg[0] = $BackButton3 GUISetState(@SW_HIDE, $Form3) Case $aMsg[0] = $BackButton2 GUISetState(@SW_HIDE, $Form2) EndSelect WEndYou must take great care when coding to avoid silly errors like those above. We all do it, but do proofread your code carefully if it does not work as expected - you will be surprised how many times it is your own coding error which is causing the problem.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...
BJJ Posted January 17, 2009 Author Share Posted January 17, 2009 yes i must be more focus Global $nMsg, $Form2 = 9999, $Form3 = 9999 , $BackButton2 = 9999 , $BackButton3 = 9999 i must write all variables in one line ?? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 17, 2009 Moderators Share Posted January 17, 2009 Quzziy, No, you can have 1 declaration per line if you wish, although it does take up a lot of space. :-) I usually break the variables into logical lines: Global <everything to do with GUI> Global <everything to do with this part of the script> Global <everything to do with that part of the script> and so on. Then if I change a section of the code and need to adjust the declarations, they are easy to find. 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...
BJJ Posted January 17, 2009 Author Share Posted January 17, 2009 nice thanks can I write ?? $x = 9999 Global $nMsg, $BackButton1 = $x , $BackButton2 = $x , $BackButton3 = $x, $BackButton4 = $x Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 17, 2009 Moderators Share Posted January 17, 2009 Quzziy, Have you tried? M23 P.S. The answer is Tak. 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...
BJJ Posted January 17, 2009 Author Share Posted January 17, 2009 Sorry but my brain is shot by work Dziękuję za pomoc 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