Jump to content
Sign in to follow this  
nitekram

Multiple GUI's

Recommended Posts

nitekram

I know that there is something written on this, but for the life of me I can not find it. WIKI, FAQ, somewhere else - can someone point me in the right direction.

Thanks


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."

 

WindowsError.gif

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

Share this post


Link to post
Share on other sites
Melba23

nitekram,

Just ask the author: Managing Multiple GUIs. ;)

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
nitekram

Thanks, my problem does not seem to be listed...I have always created Multiple GUIs with there own GUIGetMsg() loop, and I name each of my variables with their own name. I am having trouble as when I open the two GUIs and close the first one the second one closes.

I am just lost as I know I have done this in other scripts...this script is to long to post but here is a litte bit of it.

#include <array.au3>
;
#include <Constants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
; used for account gui
#include <EditConstants.au3>
#include <ComboConstants.au3>
;
#include <Date.au3>
;
#include <String.au3>
#include <Misc.au3>
;
#include <StaticConstants.au3>

HotKeySet('^h', 'GUI_Help')
HotKeySet('^l', 'HowLong')
Global $aHelpTips[50][2], $aHelpTipsStrings[50][2]
Global $showhelp = True
Global $iniFile = 'options.ini'
Global $MasterDelayTab = 50, $MasterDelayGroup = 50

while 1
sleep(20)
WEnd
Func HowLong()
 Static $junk = 0
 If $junk = 0 Then MsgBox('', 'Please use military time', 'Add 12 to any hour that is concidered PM', 1)
 $junk += 1
 Local $Date1, $Date2, $Msg_Calendar, $msgCalendar2, $StartDate, $EndDate
 Local $StartHour, $StartMinute, $EndHour, $EndMinute
 Local $GetStartDate, $GetEndDate, $Quit = False
 Local $GetDifferenceButton
 Local $GetStartHour, $GetStartMin, $GetStopHour, $GetStopMin
 Local $DifferentHour, $DifferentMin
 Local $Sec = 0, $isec, $remain
 $GUI_Date = GUICreate("Find Time", 400, 500)
 GUICtrlCreateLabel('Start Date', 0, 0)
 $StartDate = GUICtrlCreateMonthCal(@YEAR & '/' & @MON & '/' & @MDAY, 10, 25, 190, 190)
 GUICtrlCreateLabel('Start Hour', 230, 30)
 $StartHour = GUICtrlCreateInput('', 230, 60)
 GUICtrlCreateLabel('Start Minute', 300, 30)
 $StartMinute = GUICtrlCreateInput('', 300, 60)
 GUICtrlCreateLabel('End Date', 0, 245)
 $EndDate = GUICtrlCreateMonthCal(@YEAR & '/' & @MON & '/' & @MDAY, 10, 270, 190, 190)
 GUICtrlCreateLabel('End Hour', 230, 275)
 $EndHour = GUICtrlCreateInput('', 230, 305)
 GUICtrlCreateLabel('End Minute', 300, 275)
 $EndMinute = GUICtrlCreateInput('', 300, 305)
 $GetDifferenceButton = GUICtrlCreateButton('Get Time', 320, 470, Default, Default, $BS_DEFPUSHBUTTON)
 GUISetState(@SW_SHOW, $GUI_Date)
 ; Run the GUI until the dialog is closed or timeout
 While Not $Quit
  $Msg_Calendar = GUIGetMsg()
  If $Msg_Calendar = $GUI_EVENT_CLOSE Then
   MsgBox('','','why here 2592')
   $Quit = True
   GUISetState(@SW_HIDE, $GUI_Date)
   GUIDelete($GUI_Date)
  EndIf
  If $Msg_Calendar = $GetDifferenceButton Then
   $GetStartDate = GUICtrlRead($StartDate)
   $GetEndDate = GUICtrlRead($EndDate)
   $GetStartHour = GUICtrlRead($StartHour)
   If $GetStartHour = '' Then $GetStartHour = 0
   $GetStartMin = GUICtrlRead($StartMinute)
   If $GetStartMin = '' Then $GetStartMin = 0
   $GetEndHour = GUICtrlRead($EndHour)
   If $GetEndHour = '' Then $GetEndHour = 0
   $GetEndMin = GUICtrlRead($EndMinute)
   If $GetEndMin = '' Then $GetEndMin = 0
   ;$DifferentHour = $GetEndHour - $GetStartHour
   ;$DifferentMin = $GetEndMin - $GetStartMin
   Local $Start = $GetStartDate & ' ' & $GetStartHour & ':' & $GetStartMin & ':' & $Sec
   Local $End = $GetEndDate & ' ' & $GetEndHour & ':' & $GetEndMin & ':' & $Sec
   #cs
    ;MsgBox('','$Start ' & $Start,'$End ' & $End)
    Local $Day = _DateDiff('D', $Start, $End)
    If @error Then MsgBox('', 'error Date' & @error, '')
    Local $Hour = _DateDiff('h', $Start, $End)
    If @error Then MsgBox('', 'error hour' & @error, '')
    Local $Min = _DateDiff('n', $Start, $End)
    If @error Then MsgBox('', 'error min' & @error, '')
   #ce
   Local $isec = _DateDiff('s', $Start, $End)
   If @error Then MsgBox('', 'error min' & @error, 'Pleae report error message to M Thompson')
   ;$isec=176461
   $Day = Int($isec / (24 * 60 * 60))
   $remain = Mod($isec, (24 * 60 * 60))
   $hour = Int($remain / (60 * 60))
   $remain = Mod($remain, (60 * 60))
   $Min = Int($remain / 60)
   ;$Secs=Mod($remain,60)
   Local $TimeDifference = Abs($Day) & ' Days,' & Abs($hour) & ' Hours,' & Abs($Min) & ' Minutes'
   $aTimeDifferenct = StringSplit($TimeDifference, ',')
   _ArrayDelete($aTimeDifferenct, 0)
   $TimeDifference = ''
   For $x = 0 To UBound($aTimeDifferenct) - 1
    If $aTimeDifferenct[$x] <> 0 And $aTimeDifferenct[$x] <> '' Then
     If $x = 0 Then $TimeDifference &= $aTimeDifferenct[$x] & ', '
     If $x = 1 Then $TimeDifference &= $aTimeDifferenct[$x] & ', '
     If $x = 2 Then $TimeDifference &= $aTimeDifferenct[$x]
    EndIf
   Next
   #cs
    If Abs($Day) = 0 Then $TimeDifference = Abs($Hour) & ' Hours,' & Abs($Min) & ' Minutes'
    If Abs($Hour) = 0 Then $TimeDifference = Abs($Min) & ' Minutes'
   #ce
   MsgBox('', 'Added to Clip Board', $TimeDifference, 2)
   ClipPut($TimeDifference)
   GUISetState(@SW_HIDE, $GUI_Date)
   GUIDelete($GUI_Date)
   Return
  EndIf
 WEnd
EndFunc   ;==>HowLong
Func GUI_Help()
 ;Return
 Local $msg_Help, $Height = 900
 Local $CheckBoxDayLight, $CheckBox, $DST, $DelayTimeTab, $DelayTimeGroup
 Local $Reminder, $Mouser
 $GUI_Helper = GUICreate('NMC Alerter Helper', 450, $Height) ; will create a dialog box that when displayed is centered
 $aHelpTips[0][1] = GUICtrlCreateLabel("HOTKEY LIST", 75, 5)
 $aHelpTips[1][0] = GUICtrlCreateLabel("ALT+SHIFT+R - COPYS ALARM", 75, 35)
 $aHelpTips[2][0] = GUICtrlCreateLabel("Ctrl+SHIFT+S - Paste Alarm into USD", 75, 65)
 $aHelpTips[3][0] = GUICtrlCreateLabel("ALT+SHIFT+W - Copys Multiple Selections (In Progs) to clip board", 75, 95)
 $aHelpTips[4][0] = GUICtrlCreateLabel('Alt+SHIFT+V - Paste Special - NO Formatting', 75, 125)
 $aHelpTips[5][0] = GUICtrlCreateLabel('Alt+SHIFT+A- Paste Ticket with AHD# - Copy ticket 1st', 75, 160)
 $aHelpTips[6][0] = GUICtrlCreateLabel('Alt+SHIFT+G- Paste Ticket with GCAR# - Copy GCAR ticket 1st', 75, 195)
 $aHelpTips[7][0] = GUICtrlCreateLabel("Ctrl+SHIFT+H - Paste For RogueAP HELPDESK", 75, 230)
 $aHelpTips[8][0] = GUICtrlCreateLabel("Ctrl+SHIFT+M - Insert to clipboard For Moto Email & Helpdesk passes", 75, 265)
 $aHelpTips[9][0] = GUICtrlCreateLabel("Ctrl+SHIFT+L - Get list of RFOs to be used in tickets", 75, 300)
 $aHelpTips[10][0] = GUICtrlCreateLabel("Alt+SHIFT+T - Time Look up", 75, 330)
 $aHelpTips[11][0] = GUICtrlCreateLabel("Alt+SHIFT+I - Get Ticket from NEW/IN-PROGS", 75, 360)
 $aHelpTips[12][0] = GUICtrlCreateLabel("Ctrl+SHIFT+W - Get WST Site contact info from website", 75, 390)
 $aHelpTips[13][0] = GUICtrlCreateLabel("Altl+SHIFT+U - Puts clipboard to UPPERCASE", 75, 420)
 $aHelpTips[14][0] = GUICtrlCreateLabel("Altl+SHIFT+L - Puts clipboard to lowerCASE", 75, 450)
 $aHelpTips[15][0] = GUICtrlCreateLabel("Ctrl+SHIFT+Number 0-9 - Puts data into extended clipboard", 75, 480)
 $aHelpTips[16][0] = GUICtrlCreateLabel("Ctrl+ALT+Number 0-9 - Paste data from extended clipboard", 75, 510)
 $aHelpTips[17][0] = GUICtrlCreateLabel("Ctrl+SHIFT+C - Shows extended clipboard data", 75, 540)
 $aHelpTips[18][0] = GUICtrlCreateLabel("Ctrl+Alt+Shift+C - Clears all extended clipboard data", 75, 570)
 $aHelpTips[19][0] = GUICtrlCreateLabel('Ctrl+Shift+A - Shows Account Info/Procedures', 75, 600) ;ctrl alt a
 $aHelpTips[20][0] = GUICtrlCreateLabel("Ctrl+Shift+P - Paste Alarm into Paper Ticket", 75, 630)
 $aHelpTips[21][0] = GUICtrlCreateLabel("Ctrl+Shift+T - Adds to clipboard Total - copy times with GMT - TODAY ONLY", 75, 660)
 $aHelpTips[22][0] = GUICtrlCreateLabel("Ctrl+Shift+D - Highlight device name first, then it will search NetEiss", 75, 690)
 $aHelpTips[23][0] = GUICtrlCreateLabel("Ctrl+Shift+Z - Time Zone Converter", 75, 720)
 #cs
  ; not shown
  HotKeySet('!+k', 'SiteLocation') ; alt shift K
  HotKeySet('!+p', 'PlayIT') ; alt shift p
  HotKeySet('!+n', 'KillNotes') ; alt shift n
 #ce
 ;HotKeySet('^+' & $u, '_ClipPut') ;ctrl shift (plus number)
 ;HotKeySet('^!' & $u, '_ClipSend') ;ctrl alt (plus number)

 $aHelpTips[49][0] = GUICtrlCreateLabel("CTRL+SHIFT+Q - QUITS PROGRAM", 75, 750)
 $CheckBox2 = GUICtrlCreateCheckbox("Remove Tips Reminder", 75, $Height - 75)
 GUICtrlSetState(-1, $GUI_UNCHECKED)
 ;#cs
 $MouseButton = GUICtrlCreateCheckbox("Remove MouseWithoutBoards Reminder", 75, $Height - 105)
 GUICtrlSetState(-1, $GUI_UNCHECKED)
 ;#ce
 $Reminder = IniRead($iniFile, 'options', 'NO_Tips', 0)
 ;MsgBox('','$Reminder',$Reminder)
 If $Reminder = 1 Then
  GUICtrlSetState($CheckBox2, $GUI_CHECKED)
 ElseIf $Reminder = 0 Then
  GUICtrlSetState($CheckBox2, $GUI_UNCHECKED)
 EndIf
 $Mouser = IniRead($iniFile, 'options', 'NO_Mouse', 0)
 ;MsgBox('','$Mouser',$Mouser)
 If $Mouser = 1 Then
  GUICtrlSetState($MouseButton, $GUI_CHECKED)
 ElseIf $Mouser = 0 Then
  GUICtrlSetState($MouseButton, $GUI_UNCHECKED)
 EndIf

 ;
 ;
 If $showhelp Then
  Local $font = "Comic Sans MS"
  $CheckBoxDayLight = GUICtrlCreateCheckbox('', 375, $Height - 47, 20, 20)
  $Lable_EDT = GUICtrlCreateLabel('EDT ?', 395, $Height - 45)
  GUICtrlSetColor($Lable_EDT, 0xff0000) ;0x856363)
  GUICtrlSetFont($Lable_EDT, 9, 800, 4, $font)
  $DST = IniRead($iniFile, 'options', 'DST', 1)
  If $DST = 1 Then
   GUICtrlSetState($CheckBoxDayLight, $GUI_CHECKED)
  ElseIf $DST = 0 Then
   GUICtrlSetState($CheckBoxDayLight, $GUI_UNCHECKED)
  EndIf
  $CheckBox = GUICtrlCreateCheckbox('Default Columns ***', 75, $Height - 45)
  GUICtrlSetState(-1, $GUI_CHECKED)
  GUICtrlCreateLabel("*** NOTE - If any other columns are changed besides the Time columns this app will not work", 0, $Height - 15)
  GUICtrlCreateLabel('Delay for TAB:', 295, $Height - 117)
  $DelayTimeTab = GUICtrlCreateInput($MasterDelayTab, 375, $Height - 120, 30)
  GUICtrlCreateLabel('Delay for group:', 295, $Height - 87)
  $DelayTimeGroup = GUICtrlCreateInput($MasterDelayGroup, 375, $Height - 90, 30)
 EndIf
 GUISetState(@SW_SHOW) ; will display an empty dialog box
 ; Run the GUI until the dialog is closed
 While 1
  $msg_Help = GUIGetMsg()

  If $msg_Help = $GUI_EVENT_CLOSE Then
   MsgBox('','Closing Helper screen','')
   #cs
   If $showhelp Then
    If BitAND(GUICtrlRead($CheckBox), $GUI_CHECKED) = $GUI_CHECKED Then
     $column = $sFirstNotifyColumn
    Else
     $column = $sChangedFirstNotifyColumn
    EndIf
    If BitAND(GUICtrlRead($CheckBoxDayLight), $GUI_CHECKED) = $GUI_CHECKED Then
     $DayLightSavings = 4
     IniWrite($iniFile, 'options', 'DST', 1)
    Else
     $DayLightSavings = 5
     IniWrite($iniFile, 'options', 'DST', 0)
    EndIf
    $MasterDelayGroup = GUICtrlRead($DelayTimeGroup)
    $MasterDelayTab = GUICtrlRead($DelayTimeTab)
    If @UserName = 'mthompson49' Then
     If $MasterDelayTab = 0 Or $MasterDelayGroup = 0 Then MsgBox('', 'Timed value has changed', 'they are zero and should be more')
    EndIf
    If $MasterDelayTab = 0 Then $MasterDelayTab = 100
    If $MasterDelayGroup = 0 Then $MasterDelayGroup = 250
    IniWrite($iniFile, 'options', 'DelayTab', $MasterDelayTab)
    IniWrite($iniFile, 'options', 'DelayGroup', $MasterDelayGroup)
   EndIf
   If BitAND(GUICtrlRead($CheckBox2), $GUI_CHECKED) = $GUI_CHECKED Then
    IniWrite($iniFile, 'options', 'NO_Tips', 1)
    $Reminder = 1
   Else
    IniWrite($iniFile, 'options', 'NO_Tips', 0)
    $Reminder = 0
   EndIf

   If BitAND(GUICtrlRead($MouseButton), $GUI_CHECKED) = $GUI_CHECKED Then
    IniWrite($iniFile, 'options', 'NO_Mouse', 1)
    $Mouser = 1
   Else
    IniWrite($iniFile, 'options', 'NO_Mouse', 0)
    $Mouser = 0
   EndIf
#ce
   GUISetState(@SW_HIDE, $GUI_Helper)
   GUIDelete($GUI_Helper)
   ExitLoop
  EndIf
 WEnd
 For $x = 0 To UBound($aHelpTips) - 1
  ;MsgBox('','GUICtrlRead($aHelpTips[$x][1])',GUICtrlRead($aHelpTips[$x][1]))
  If GUICtrlRead($aHelpTips[$x][0]) <> '' Then
   $aHelpTipsStrings[$x][0] = GUICtrlRead($aHelpTips[$x][0])
  EndIf
 Next
 ;_ArrayDisplay($aHelpTipsStrings)
 GUISetState(@SW_HIDE, $GUI_Helper)
 GUIDelete($GUI_Helper)
 If $Reminder <> 1 Then
  ;Tip of the day, runs on start and anytime user shows hotkey list
  Local $Quit = False
  Do
   $x = Random(0, 49, 1)
   If $aHelpTipsStrings[$x][0] <> '' Or $aHelpTipsStrings[$x][0] <> 0 Then
    $Quit = True
   EndIf
  Until $Quit
  MsgBox('', 'TIP OF THE DAY', 'Here is your tip of the day' & @CRLF & @CRLF & $aHelpTipsStrings[$x][0])
 EndIf
EndFunc   ;==>GUI_Help
Edited by nitekram

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."

 

WindowsError.gif

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

Share this post


Link to post
Share on other sites
nitekram

In either case, the first gui closes the second gui...sorry for posting again, I did not want to mess up my TIDY format.

just the two hot keys

Ctrl h, Ctrl L


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."

 

WindowsError.gif

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

Share this post


Link to post
Share on other sites
FireFox

@nitekram

You should use the main loop to catch the GUI messages and not seperated loops for each GUI because it blocks the whole script, in conclusion this is a bad coding practice. Use the advanced parameter of the GUIGetMsg function as showed in the FAQ.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
nitekram

I am not sure I understand why it is bad...this way I keep all my controls in the area that is created by the functions. Not saying you are wrong, but that would be a pain, because everytime you create a controle you would have to move up to the main while loop and put the info there - in a rather long script (like over 5000 lines) I would have to move all them into a rather large While Loop and have to navigate to the While loop from the bottom to the top?

Can you explain why this is bad, because I have always done it this way and it seems to work, except for this example.

Thanks for you input and help!

EDIT OK, I am reading the WIKI now, as I just was looking for a coding example like mine, please do not hit me over the head until I am done readint

Edited by nitekram

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."

 

WindowsError.gif

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

Share this post


Link to post
Share on other sites
nitekram

Not trying to double post, but @Melba23 - you have this line in your WIKI - can you point me to it, the other Turorial???

As you can see, we have a single While...WEnd loop which distinguishes between the two GUIs, both GUIs and their controls remain active and we stay in the main idle loop while we wait (you did read that other tutorial I hope!).

EDIT

This code from the example does exactly what I do not want, I do not want to close both windows? When you close the first gui it closed both windows???

#include <GUIConstantsEx.au3>
 Global $hGUI2 = 9999, $hButton3 = 9999 ; Predeclare the variables with dummy values to prevent firing the Case statements
 gui1()
 Func gui1()
     $hGUI1 = GUICreate("Gui 1", 200, 200, 100, 100)
     $hButton1 = GUICtrlCreateButton("Msgbox 1", 10, 10, 80, 30)
     $hButton2 = GUICtrlCreateButton("Show Gui 2", 10, 60, 80, 30)
     GUISetState()
     While 1
         $aMsg = GUIGetMsg(1) ; Use advanced parameter to get array
         Switch $aMsg[1] ; check which GUI sent the message
             Case $hGUI1
                 Switch $aMsg[0] ; Now check for the messages for $hGUI1
                     Case $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we exit <<<<<<<<<<<<<<<
                         ExitLoop
                     Case $hButton1
                         MsgBox("", "MsgBox 1", "Test from Gui 1")
                     Case $hButton2
                         GUICtrlSetState($hButton2, $GUI_DISABLE)
                         gui2()
                 EndSwitch
             Case $hGUI2
                 Switch $aMsg[0] ; Now check for the messages for $hGUI2
                     Case $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we just delete the GUI <<<<<<<<<<<<<<<
                         GUIDelete($hGUI2)
                         GUICtrlSetState($hButton2, $GUI_ENABLE)
                     Case $hButton3
                         MsgBox("", "MsgBox", "Test from Gui 2")
                 EndSwitch
         EndSwitch
     WEnd
 EndFunc   ;==>gui1
 Func gui2()
     $hGUI2 = GUICreate("Gui 2", 200, 200, 350, 350)
     $hButton3 = GUICtrlCreateButton("MsgBox 2", 10, 10, 80, 30)
     GUISetState()
 EndFunc   ;==>gui2
Edited by nitekram

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."

 

WindowsError.gif

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

Share this post


Link to post
Share on other sites
Melba23

nitekram,

The other tutorial to which I refer is the Interrupting a running function tutorial, also in the Wiki and mentioned earlier in the "Multiple GUI" tutorial - but I do not think that is what you want. :)

As to the code you posted, when I run it clicking the [X] on GUI2 only closes GUI2 and does not exit the script - of course clicking the [X] on GUI1 closes everything as that is what you tell it to do. ;)

Anyway, I do not agree with FireFox's comment - I have many dialog style GUIs with their own While...WEnd loop - that way you can avoid situations such as you have just described, although it does have some downsides as you are blocked in the child GUI until you close it and return to the main loop. What exactly do you want to do? If you can give me a clear understanding, I can certainly try to give you some code to match. :)

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
nitekram

The GUI_Help() is a help gui to use by the end user...if the end user opens that window in order to get the info (help keys) and then runs a hotkey to open another window..I want to be able to close the GUI_Help() and leave the other GUI up and running. I also want the end user to be able to close the second GUI, if it is not what is needed and keep the GUI_Help() active.

Hope that is clear as mud...


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."

 

WindowsError.gif

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

Share this post


Link to post
Share on other sites
FireFox

it does have some downsides as you are blocked in the child GUI until you close it and return to the main loop.

That's what I meant but I wanted to point out that the GUI is re-created again each time the function is called in his script.

I never use the GUIGetMsg function except for examples to catch the close message for these reasons :

-You can't set a high sleep in your loop otherwise the messages won't be caught.

-It makes to much indents and I prefer to have a loop as small as possible that's why event functions are perfect.

-If you use sub whiles for each GUI the rest of the script is blocked.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Melba23

nitekram,

That is just an extension of the code in the tutorial to cover 3 GUIs and not just 2: ;)

#include <GUIConstantsEx.au3>

Global $hHelp = 9999, $hChild = 9999

HotKeySet("^+q", "_Child_Create")

$hGUI = GUICreate("Test", 500, 500)

$mHelpMenu = GUICtrlCreateMenu("Help")
$mHelpItem = GUICtrlCreateMenuItem("HotKeys", $mHelpMenu)

GUISetState()

While 1

    $aMsg = GUIGetMsg(1)
    Switch $aMsg[1]
        Case $hGUI
            Switch $aMsg[0]
                Case $GUI_EVENT_CLOSE
                    Exit
                Case $mHelpItem
                    _Help_Create()
            EndSwitch
        Case $hHelp
            Switch $aMsg[0]
                Case $GUI_EVENT_CLOSE
                    GUIDelete($hHelp)
            EndSwitch
        Case $hChild
            Switch $aMsg[0]
                Case $GUI_EVENT_CLOSE
                    GUIDelete($hChild)
            EndSwitch
    EndSwitch

WEnd

Func _Help_Create()

    $hHelp = GUICreate("Gui 2", 200, 200, 350, 350)
    GUICtrlCreateLabel("Press Ctrl-Q to create a child GUI", 10, 10, 180, 40)
    GUISetState()

    ConsoleWrite("Hit" & @CRLF)


EndFunc

Func _Child_Create()

    $hChild = GUICreate("Child", 200, 200, 150, 150)
    GUICtrlCreateLabel("This is a child GUI", 10, 10, 180, 40)
    GUISetState()

EndFunc

All clear? :)

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
nitekram

That does not fit my needs. The first gui needs to be able to be closed, while keeping the child guis opened and visa versa.

Thanks for your help, so far!


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."

 

WindowsError.gif

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

Share this post


Link to post
Share on other sites
Melba23

nitekram,

So how do you exit the script? :huh:

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
nitekram

$aHelpTips[49][0] = GUICtrlCreateLabel("CTRL+SHIFT+Q - QUITS PROGRAM", 75, 750)

The whole program is hidden from the end user until they hit the hotkeys and depending on what they hit they get a different type of windows/function/tool...if all windows are closed, the program is still running, and I delete each gui upon exit of that gui, and then recreate the gui when need.

I believe it has to be possible right, or do I need to create a separate script for each of my GUI's - I believe my logic is sound in my example, but I may have missed something

Again, thanks for your help


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."

 

WindowsError.gif

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

Share this post


Link to post
Share on other sites
FireFox

@nitekram

I don't understand what is the problem. Replace the Exit statement in Melba23's script by GUIDelete($hGUI) and maybe it will show what you wanted.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Melba23

nitekram,

It is a little more complicated than FireFox suggests (you need a function to create the main GUI), but still pretty easy:

#include <GUIConstantsEx.au3>

Global $hGUI = 9999, $hHelp = 9999, $hChild = 9999
Global $mHelpItem = 9999

HotKeySet("^+w", "_Main_Create")
HotKeySet("^+q", "_Child_Create")

While 1

    $aMsg = GUIGetMsg(1)
    Switch $aMsg[1]
        Case $hGUI
            Switch $aMsg[0]
                Case $GUI_EVENT_CLOSE
                    GUIDelete($hGUI)
                Case $mHelpItem
                    _Help_Create()
            EndSwitch
        Case $hHelp
            Switch $aMsg[0]
                Case $GUI_EVENT_CLOSE
                    GUIDelete($hHelp)
            EndSwitch
        Case $hChild
            Switch $aMsg[0]
                Case $GUI_EVENT_CLOSE
                    GUIDelete($hChild)
            EndSwitch
    EndSwitch

WEnd

Func _Main_Create()

    $hGUI = GUICreate("Test", 500, 500)

    Local $mHelpMenu = GUICtrlCreateMenu("Help")
    $mHelpItem = GUICtrlCreateMenuItem("HotKeys", $mHelpMenu)

    GUISetState()

EndFunc

Func _Help_Create()

    $hHelp = GUICreate("Gui 2", 200, 200, 350, 350)
    GUICtrlCreateLabel("Press Ctrl-Q to create a child GUI", 10, 10, 180, 40)
    GUISetState()

EndFunc

Func _Child_Create()

    $hChild = GUICreate("Child", 200, 200, 150, 150)
    GUICtrlCreateLabel("This is a child GUI", 10, 10, 180, 40)
    GUISetState()

EndFunc

Are we there now? :)

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
FireFox

Create Show/Hide :

#include <GUIConstantsEx.au3>

Global $hGUI1 = 0, $hGUI2 = 0, $hGUI3 = 0

HotKeySet("{F1}", "_GUI1")
HotKeySet("{F2}", "_GUI2")
HotKeySet("{F3}", "_GUI3")

HotKeySet("{ESC}", "_Exit")

While 1
    $aMsg = GUIGetMsg(1)

    Switch $aMsg[0]
        Case $GUI_EVENT_CLOSE
            GUISetState(@SW_HIDE, $aMsg[1])
    EndSwitch

    Sleep(10)
WEnd

Func _GUI1()
    If $hGUI1 > 0 Then
        GUISetState(@SW_SHOW, $hGUI1)
        Return ;void
    EndIf

    $hGUI1 = GUICreate("Child 1", 200, 200, 150, 150)
    GUICtrlCreateLabel("This is a child GUI", 10, 10, 180, 40)
    GUISetState()
EndFunc   ;==>_GUI1

Func _GUI2()
    If $hGUI2 > 0 Then
        GUISetState(@SW_SHOW, $hGUI2)
        Return ;void
    EndIf

    $hGUI2 = GUICreate("Child 2", 200, 200, 150, 150)
    GUICtrlCreateLabel("This is a child GUI", 10, 10, 180, 40)
    GUISetState()
EndFunc   ;==>_GUI2

Func _GUI3()
    If $hGUI3 > 0 Then
        GUISetState(@SW_SHOW, $hGUI3)
        Return ;void
    EndIf

    $hGUI3 = GUICreate("Child 3", 200, 200, 150, 150)
    GUICtrlCreateLabel("This is a child GUI", 10, 10, 180, 40)
    GUISetState()
EndFunc   ;==>_GUI3

Func _Exit()
    Exit
EndFunc   ;==>_Exit

Create/Delete :

#include <GUIConstantsEx.au3>

Global $hGUI1 = 0, $hGUI2 = 0, $hGUI3 = 0

HotKeySet("{F1}", "_GUI1")
HotKeySet("{F2}", "_GUI2")
HotKeySet("{F3}", "_GUI3")

HotKeySet("{ESC}", "_Exit")

While 1
    $aMsg = GUIGetMsg(1)

    Switch $aMsg[1]
        Case $hGUI1
            Switch $aMsg[0]
                Case $GUI_EVENT_CLOSE
                    GUIDelete($hGUI1)
                    $hGUI1 = 0
            EndSwitch
        Case $hGUI2
            Switch $aMsg[0]
                Case $GUI_EVENT_CLOSE
                    GUIDelete($hGUI2)
                    $hGUI2 = 0
            EndSwitch
        Case $hGUI3
            Switch $aMsg[0]
                Case $GUI_EVENT_CLOSE
                    GUIDelete($hGUI3)
                    $hGUI3 = 0
            EndSwitch
    EndSwitch

    Sleep(10)
WEnd

Func _GUI1()
    If $hGUI1 > 0 Then Return ;void

    $hGUI1 = GUICreate("Child 1", 200, 200, 150, 150)
    GUICtrlCreateLabel("This is a child GUI", 10, 10, 180, 40)
    GUISetState()
EndFunc   ;==>_GUI1

Func _GUI2()
    If $hGUI2 > 0 Then Return ;void

    $hGUI2 = GUICreate("Child 2", 200, 200, 150, 150)
    GUICtrlCreateLabel("This is a child GUI", 10, 10, 180, 40)
    GUISetState()
EndFunc   ;==>_GUI2

Func _GUI3()
    If $hGUI3 > 0 Then Return ;void

    $hGUI3 = GUICreate("Child 3", 200, 200, 150, 150)
    GUICtrlCreateLabel("This is a child GUI", 10, 10, 180, 40)
    GUISetState()
EndFunc   ;==>_GUI3

Func _Exit()
    Exit
EndFunc   ;==>_Exit

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
nitekram

FireFox -

I missed that - so sorry

I understand how @Melba23 codes works now, but given my argument above is there a better way for me.. I have already got dozens of GUI's and I would think there might be 3 or more controls to each GUI, I can see my while loop get way out of control and I am still stuck with finding the loop in the code, and then bringing all my controls (no pun) back up to the main while loop -- I think that is going to be harder then it shoud be? Drilling up scite - yea there are short-cuts that I am still learning, but why cannot I have it my way? As long as I do not duplicate variables I assumed it would work. And almost positve I did this in another of my scripts.

Let me check out whay you all posted, and I will see if it fixes my pain.

EDIT

On Melba23s code I did replace, but now have now way of closing that last guI?

Edited by nitekram

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."

 

WindowsError.gif

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

Share this post


Link to post
Share on other sites
FireFox

but why cannot I have it my way?

We are not saying that it's not possible in your way, it's just more complicated for nothing.

Edit: Let me explain the problem for "your way".

As we said each while block the rest of the script, so you can't have more than one while running (in your script), then you will understand that you will not be able to catch the close message of the 2nd or 3rd GUI if you are listening for the 1st GUI messages.

If you really want to continue in that way you will need to have identical sub whiles listening to every GUI which can be showed in the same time, meaning that you will need global variables, meaning that you will finally give up to our code in the way we gave you.

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
nitekram

Create Show/Hide :

Create/Delete :

In Each of these examples, I assume that action will only take place if the control is in the Main While loop, while I see this is the main way, I am, I guess thinking out side the box...I do not want to pull everying into this massive huge 3 or 5 pages of scrolling to make sure I am in the right spot in the while loop so I can keep things tidy (again no pun), I would want all my conrols that match my gui to be all together?

Edit spelling

Edited by nitekram

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."

 

WindowsError.gif

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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×