Medryn Posted March 5, 2009 Share Posted March 5, 2009 I'm new to AutoIt & forums and I'm trying to make a program that works on the same concept as a Windows Installer in how it continues to provide windows of options through navigation using next & cancel buttons. I've played with some ideas in AutoIt but keep hitting dead ends. What is the most efficient way to code this? What I'd like to start with is 3 seperate windows sequentially. Window 1 shows, options selected, next > Window 2 shows, options selected, next > Windows 3 shows options selected, next > and so on... Thanks for the view!! Medryn Link to comment Share on other sites More sharing options...
enaiman Posted March 5, 2009 Share Posted March 5, 2009 Don't bother using separate windows - use tabs instead; the "Next" button will make the next tab to show. expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 329, 297, 193, 125) GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close") $Tab1 = GUICtrlCreateTab(8, 8, 313, 281) GUICtrlSetState($Tab1,$GUI_HIDE) ;this is very important here $TabSheet1 = GUICtrlCreateTabItem("TabSheet1") GUICtrlSetState(-1,$GUI_SHOW) $Button1 = GUICtrlCreateButton("Next", 232, 256, 75, 25, 0) GUICtrlSetOnEvent(-1, "Button1Click") $Label1 = GUICtrlCreateLabel("This is TAB 1", 88, 80, 156, 17, $SS_CENTER) GUICtrlSetFont(-1, 9, 400, 0, "Tahoma") $TabSheet2 = GUICtrlCreateTabItem("TabSheet2") $Button2 = GUICtrlCreateButton("Previous", 16, 256, 75, 25, 0) GUICtrlSetOnEvent(-1, "Button2Click") $Button3 = GUICtrlCreateButton("Next", 232, 256, 75, 25, 0) GUICtrlSetOnEvent(-1, "Button3Click") $Label2 = GUICtrlCreateLabel("This is TAB 2", 90, 89, 156, 17, $SS_CENTER) GUICtrlSetFont(-1, 9, 400, 0, "Tahoma") $TabSheet3 = GUICtrlCreateTabItem("TabSheet3") $Button4 = GUICtrlCreateButton("Previous", 16, 256, 75, 25, 0) GUICtrlSetOnEvent(-1, "Button4Click") $Label3 = GUICtrlCreateLabel("This is TAB 3", 79, 90, 156, 17, $SS_CENTER) GUICtrlSetFont(-1, 9, 400, 0, "Tahoma") GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Sleep(100) WEnd Func Button1Click() GUICtrlSetState($TabSheet2,$GUI_SHOW) EndFunc Func Button2Click() GUICtrlSetState($TabSheet1,$GUI_SHOW) EndFunc Func Button3Click() GUICtrlSetState($TabSheet3,$GUI_SHOW) EndFunc Func Button4Click() GUICtrlSetState($TabSheet2,$GUI_SHOW) EndFunc Func Form1Close() Exit EndFunc SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 5, 2009 Moderators Share Posted March 5, 2009 Medryn, Here is a simple example with 3 GUIs created at the start and then shown/hidden as required:expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 260, 200, 190, 120) $Button11 = GUICtrlCreateButton("Next", 150, 100, 80, 30) GUISetState(@SW_SHOW) $Form2 = GUICreate("Form2", 260, 200, 290, 220) $Button21 = GUICtrlCreateButton("Back", 150, 60, 80, 30) $Button22 = GUICtrlCreateButton("Next", 150, 100, 80, 30) GUISetState(@SW_HIDE) $Form3 = GUICreate("Form3", 260, 200, 390, 320) $Button31 = GUICtrlCreateButton("Back", 150, 60, 80, 30) $Button32 = GUICtrlCreateButton("Exit", 150, 100, 80, 30) GUISetState(@SW_HIDE) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button11 _Form2() EndSwitch WEnd Func _Form2() GUISetState(@SW_HIDE, $Form1) GUISetState(@SW_SHOW, $Form2) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button21 GUISetState(@SW_HIDE, $Form2) GUISetState(@SW_SHOW, $Form1) Return Case $Button22 _Form3() Return EndSwitch WEnd EndFunc Func _Form3() GUISetState(@SW_HIDE, $Form2) GUISetState(@SW_SHOW, $Form3) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $Button32 Exit Case $Button31 GUISetState(@SW_HIDE, $Form3) GUISetState(@SW_SHOW, $Form1) Return EndSwitch WEnd EndFunc 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...
Medryn Posted March 5, 2009 Author Share Posted March 5, 2009 M23: Thanks, thats perfect! Exactly what I was looking for. I see that my mistake was I wasn't understanding how to use Case within the While statements... you definately cleared it up for me. Ena I really liked your alternate suggestion to, I can definately use this elsewhere, thanks a million! AutoIt is great, but having such a good community and forum help is even better! Medryn 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