Jump to content

Multiple GUI's


Recommended Posts

it's just more complicated for nothing.

It might be complicated, but it reads so much better, I can then port my functions (everything included) from one program to another, and all I have to do is call the function name with a hotkey or from some other gui - surly you can see the benifit in that? 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

Link to comment
Share on other sites

It might be complicated, but it reads so much better, I can then port my functions (everything included) from one program to another, and all I have to do is call the function name with a hotkey or from some other gui - surly you can see the benifit in that?

Use the onevent functions, that's exactly what you are searching for.

Please read my edited previous post.

Link to comment
Share on other sites

Use the onevent functions, that's exactly what you are searching for.

Please read my edited previous post. READ

I believe you are right...when I first started with this language, that is all I used, and found it good until you had to call a function with a flag/parameter and I guess I should have stuck to it, as later, when I wrote this other script purley with onEvent I found a cool little macro - not sure when it first appeared, but I did not know about until a bout 2 months or so ago - @GUI_CtrlId

Guess I got my work cut out for me, as I have to rewrite a lot of code - either way - Thanks FireFox

@Melba23 - if you come up with anything different, let me know, but it does not look possilbe. 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

Link to comment
Share on other sites

I found a cool little macro @GUI_CtrlId

Well I personaly set one function for one Id to make it as clear as possible, but you can use it for GUI events (such as close).

Edit: And... no because it will return the close event and not the GUI handle.

Br, FireFox.

Edited by FireFox
Link to comment
Share on other sites

  • Moderators

nitekram,

Take a look at this version of the script I posted last night - all the GUIs are in self-contained regions and their only demand on the main section is to have the variable containing their handles declared as Global (you could do this within the creation function itself, but I would not consider this as good practice). Does this get closer to what you want: :huh:

#Region ; Main

#include <GUIConstantsEx.au3>

Opt("GUIOnEventMode", 1)

Global $hMain, $hHelp, $hChild

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

While 1
    Sleep(10)
WEnd

#EndRegion
#Region ; Main GUI

Func _Main_Create()

    $hMain = GUICreate("Test", 500, 500)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Main_Exit")
    Local $mHelpMenu = GUICtrlCreateMenu("Help")
    GUICtrlCreateMenuItem("HotKeys", $mHelpMenu)
    GUICtrlSetOnEvent(-1, "_Help_Create")
    GUICtrlCreateButton("Main Test", 10, 50, 80, 30)
    GUICtrlSetOnEvent(-1, "_Main_Test")
    GUISetState()
EndFunc

Func _Main_Exit()
    GUIDelete($hMain)
EndFunc

Func _Main_Test()
    MsgBox(0, "Main GUI", "Main GUI Button Pressed!")
EndFunc

#Endregion
#Region ; Help GUI

Func _Help_Create()
    $hHelp = GUICreate("Gui 2", 200, 200, 350, 350)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Help_Exit")
    GUICtrlCreateLabel("Press Ctrl-Q to create a child GUI", 10, 10, 180, 40)
    GUICtrlCreateButton("Help Test", 10, 50, 80, 30)
    GUICtrlSetOnEvent(-1, "_Help_Test")
    GUISetState()
EndFunc

Func _Help_Exit()
    GUIDelete($hHelp)
EndFunc

Func _Help_Test()
    MsgBox(0, "Help GUI", "Help GUI Button Pressed!")
EndFunc

#Endregion
#Region ; Child GUI

Func _Child_Create()
    $hChild = GUICreate("Child", 200, 200, 150, 150)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Child_Exit")
    GUICtrlCreateLabel("This is a child GUI", 10, 10, 180, 40)
    GUICtrlCreateButton("Child Test Test", 10, 50, 80, 30)
    GUICtrlSetOnEvent(-1, "_Child_Test")
    GUISetState()
EndFunc

Func _Child_Exit()
    GUIDelete($hChild)
EndFunc

Func _Child_Test()
    MsgBox(0, "Child GUI", "Child GUI Button Pressed!")
EndFunc

#Endregion

Well, does it? :)

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

 

Link to comment
Share on other sites

I would suggest OnEvent mode also for what you want to do

For Melbas example above, you can have just one function to delete the GUI you clicked to close by using GUIDelete(@GUI_WinHandle) instead of 3 function, one for each GUI.

Func _Any_Exit()
     GUIDelete(@GUI_WinHandle)
EndFunc

Edit: This will also eliminate the need for those Global variables

so Melba's script above would be

#Region ; Main

#include <GUIConstantsEx.au3>

Opt("GUIOnEventMode", 1)

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

While 1
    Sleep(10)
WEnd

#EndRegion
#Region ; Main GUI

Func _Main_Create()

    $hMain = GUICreate("Test", 500, 500)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Main_Exit")
    Local $mHelpMenu = GUICtrlCreateMenu("Help")
    GUICtrlCreateMenuItem("HotKeys", $mHelpMenu)
    GUICtrlSetOnEvent(-1, "_Help_Create")
    GUICtrlCreateButton("Main Test", 10, 50, 80, 30)
    GUICtrlSetOnEvent(-1, "_Any_Exit")
    GUISetState()
EndFunc

Func _Main_Test()
    MsgBox(0, "Main GUI", "Main GUI Button Pressed!")
EndFunc

#Endregion
#Region ; Help GUI

Func _Help_Create()
    $hHelp = GUICreate("Gui 2", 200, 200, 350, 350)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Help_Exit")
    GUICtrlCreateLabel("Press Ctrl-Q to create a child GUI", 10, 10, 180, 40)
    GUICtrlCreateButton("Help Test", 10, 50, 80, 30)
    GUICtrlSetOnEvent(-1, "_Any_Exit")
    GUISetState()
EndFunc

Func _Help_Test()
    MsgBox(0, "Help GUI", "Help GUI Button Pressed!")
EndFunc

#Endregion
#Region ; Child GUI

Func _Child_Create()
    $hChild = GUICreate("Child", 200, 200, 150, 150)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Any_Exit")
    GUICtrlCreateLabel("This is a child GUI", 10, 10, 180, 40)
    GUICtrlCreateButton("Child Test Test", 10, 50, 80, 30)
    GUICtrlSetOnEvent(-1, "_Child_Test")
    GUISetState()
EndFunc

Func _Child_Test()
    MsgBox(0, "Child GUI", "Child GUI Button Pressed!")
EndFunc

#Endregion
Func _Any_Exit()
    GUIDelete(@GUI_WinHandle)
EndFunc
Edited by AoRaToS

s!mpL3 LAN Messenger

Current version 2.9.9.1 [04/07/2019]

s!mpL3 LAN Messenger.zip

s!mpL3

Link to comment
Share on other sites

  • Moderators

AoRaToS,

You are quite corerct, but nitekram wanted to have all the functions for each GUI in a separate section which is why I went for individual functions. ;)

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

 

Link to comment
Share on other sites

nitekram,

Does this get closer to what you want: :huh:

Well, does it? :)

M23

Real close, but it appears that the focus gets lost. I opened up the main gui, and 3 child guis and on the third one and the second one, I click the child test button - after ward the only window I was able to close was the main - the children witl not close.

The second time I ran it, agian with main and 3 children, I was albe to close the third gui after clicking the button, but then the second one after clicking button and the first one would not close - still the main one closes each time.

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

Link to comment
Share on other sites

  • Moderators

nitekram,

That was a proof of concept script which only allowed for 1 child GUI. I will see what I can do to allow for the creation of several children, but be advised that doing so might significantly affect the modularity of the script. ;)

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

 

Link to comment
Share on other sites

  • Moderators

nitekram,

Does this meet your requirements: :sweating:

#Region ; Main

#include <GUIConstantsEx.au3>
#include <Array.au3>

Opt("GUIOnEventMode", 1)

Global $hMain, $hHelp, $hChild
Global $aChild[1] = [0]

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

While 1
    Sleep(10)
WEnd

#EndRegion
#Region ; Main GUI

Func _Main_Create()

    $hMain = GUICreate("Test", 500, 500)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Main_Exit")
    Local $mHelpMenu = GUICtrlCreateMenu("Help")
    GUICtrlCreateMenuItem("HotKeys", $mHelpMenu)
    GUICtrlSetOnEvent(-1, "_Help_Create")
    GUICtrlCreateButton("Main Test", 10, 50, 80, 30)
    GUICtrlSetOnEvent(-1, "_Main_Test")
    GUISetState()
EndFunc

Func _Main_Exit()
    GUIDelete($hMain)
EndFunc

Func _Main_Test()
    MsgBox(0, "Main GUI", "Main GUI Button Pressed!")
EndFunc

#Endregion
#Region ; Help GUI

Func _Help_Create()
    $hHelp = GUICreate("Gui 2", 200, 200, 350, 350)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Help_Exit")
    GUICtrlCreateLabel("Press Ctrl-Q to create a child GUI", 10, 10, 180, 40)
    GUICtrlCreateButton("Help Test", 10, 50, 80, 30)
    GUICtrlSetOnEvent(-1, "_Help_Test")
    GUISetState()
EndFunc

Func _Help_Exit()
    GUIDelete($hHelp)
EndFunc

Func _Help_Test()
    MsgBox(0, "Help GUI", "Help GUI Button Pressed!")
EndFunc

#Endregion
#Region ; Child GUI

Func _Child_Create()
    $aChild[0] += 1
    ReDim $aChild[$aChild[0] + 1]
    $aChild[$aChild[0]] = GUICreate("Child " & $aChild[0], 200, 200, 150, 150)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Child_Exit")
    GUICtrlCreateLabel("This is a child GUI", 10, 10, 180, 40)
    GUICtrlCreateButton("Child Test", 10, 50, 80, 30)
    GUICtrlSetOnEvent(-1, "_Child_Test")
    GUISetState()
EndFunc

#Region
#Region ; Common Child functions

Func _Child_Exit()
    $hGUI = @GUI_WINHANDLE
    GUIDelete($hGUI)
    $iIndex = _ArraySearch($aChild, $hGUI)
    If $iIndex <> -1 Then
        _ArrayDelete($aChild, $iIndex)
        $aChild[0] -= 1
    EndIf
EndFunc

Func _Child_Test()
    $hGUI = @GUI_WINHANDLE
    $iIndex = _ArraySearch($aChild, $hGUI)
    If $iIndex <> -1 Then
        MsgBox(0, "Child " & $iIndex & " GUI", "Child " & $iIndex & " GUI Button Pressed!")
    EndIf
EndFunc

#Endregion

I do hope so! :D

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

 

Link to comment
Share on other sites

Really close, but somewhere there is a bug. Opened 3 children, pressed the buttons, then closed the popup and then closed the first child, then the main - then pressed the button on child 2, the popup was for child 1?

Trying to duplicate the pattern - so far have not been able to.

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

Link to comment
Share on other sites

Opened 3 children, pressed the buttons, then closed the popup and then closed the first child, then the main - then pressed the button on child 2, the popup was for child 1?

:x

Melba23 is going to reinvent the wheel for you :ermm:

Link to comment
Share on other sites

Replicated it:

opend main, followed by 3 children

close child 1

close main

click on button child 2 - brings up child 1 button pressed

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

Link to comment
Share on other sites

:x

Melba23 is going to reinvent the wheel for you :ermm:

I thank him for his time...I wonder if this is not aloud (the way I want) because AutoIt is not multi process language?

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

Link to comment
Share on other sites

I have come up with this - can you break it?

#Region ; Main
#include <GUIConstantsEx.au3>
#include <Array.au3>
Opt("GUIOnEventMode", 1)
Global $hMain, $hHelp, $hChild
Global $aChild[1] = [0]
Global $aChildButton[1] = [0]
HotKeySet("^+w", "_Main_Create")
HotKeySet("^+q", "_Child_Create")
While 1
    Sleep(10)
WEnd
#EndRegion
#Region ; Main GUI
Func _Main_Create()
    $hMain = GUICreate("Test", 500, 500)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Main_Exit")
    Local $mHelpMenu = GUICtrlCreateMenu("Help")
    GUICtrlCreateMenuItem("HotKeys", $mHelpMenu)
    GUICtrlSetOnEvent(-1, "_Help_Create")
    GUICtrlCreateButton("Main Test", 10, 50, 80, 30)
    GUICtrlSetOnEvent(-1, "_Main_Test")
    GUISetState()
EndFunc
Func _Main_Exit()
    GUIDelete($hMain)
EndFunc
Func _Main_Test()
    MsgBox(0, "Main GUI", "Main GUI Button Pressed!")
EndFunc
#Endregion
#Region ; Help GUI
Func _Help_Create()
    $hHelp = GUICreate("Gui 2", 200, 200, 350, 350)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Help_Exit")
    GUICtrlCreateLabel("Press Ctrl-Q to create a child GUI", 10, 10, 180, 40)
    GUICtrlCreateButton("Help Test", 10, 50, 80, 30)
    GUICtrlSetOnEvent(-1, "_Help_Test")
    GUISetState()
EndFunc
Func _Help_Exit()
    GUIDelete($hHelp)
EndFunc
Func _Help_Test()
    MsgBox(0, "Help GUI", "Help GUI Button Pressed!")
EndFunc
#Endregion
#Region ; Child GUI
Func _Child_Create()
    $aChild[0] += 1
 $aChildButton[0] += 1
    ReDim $aChild[$aChild[0] + 1]
 ReDim $aChildButton[$aChildButton[0] + 1]
    $aChild[$aChild[0]] = GUICreate("Child " & $aChild[0], 200, 200, 150, 150)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Child_Exit")
    GUICtrlCreateLabel("This is a child GUI", 10, 10, 180, 40)
    $aChildButton[$aChildButton[0]] = GUICtrlCreateButton("Child Test", 10, 50, 80, 30)
    GUICtrlSetOnEvent(-1, "_Child_Test")
    GUISetState()
EndFunc
#Region
#Region ; Common Child functions
Func _Child_Exit()
    $hGUI = @GUI_WINHANDLE
    GUIDelete($hGUI)
    $iIndex = _ArraySearch($aChild, $hGUI)
    If $iIndex <> -1 Then
        _ArrayDelete($aChild, $iIndex)
        $aChild[0] -= 1
    EndIf
EndFunc
Func _Child_Test()
 $hCrl = @GUI_CtrlId
    $iIndex = _ArraySearch($aChildButton, $hCrl)
    If $iIndex <> -1 Then
        MsgBox(0, "Child " & $iIndex & " GUI", "Child " & $iIndex & " GUI Button Pressed!")
    EndIf
EndFunc
#Endregion

Guess it make it better would be to combine the two single arrays into one 2D array

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

Link to comment
Share on other sites

  • Moderators

nitekram,

As I still have no real idea what you are trying to do with all these GUIs - your explanations have not exactly been models of limpidity - I am withdrawing from this thread. We have shown you several ways to manage multiple GUIs and suggested even more. If you are happy with the code you posted above then I am delighted for you - but if not, then you are going to have to continue the development without me. :)

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

 

Link to comment
Share on other sites

I am sorry that I lost you along the way. I do value your time - sorry if I was not able to make it clear of what I wanted.

For anyone else reading. The idea is/was to be able to have a master window opened - that lists all the tools/hotkeys that are available (all the tools available to the end user). That window could remain open for the duration of the day, and the end user can minimize it, or close it. That being said, opening a tool/hotkey from the list of the main window would be the end users choice. If the end user picked the wrong tool/hotkey, they should be able to close that windows tool and return to the main window to find another tool/hotkey. If they found the right tool/hotkey then they should be able to close the main window that lists all the tools/hotkeys or leave it open - as stated above - the main window is just a list of tools/hotkeys available.

I believe that it is not possible from I am being told above. Maybe I will just write all the tools in their own separate script and call them from main window.

I do want to thank Melba23 and FireFox for their time - 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

Link to comment
Share on other sites

nitekram,

You do not provide a way to exit the script, is this your intent? If so, you may want to enforce a single instance of this script running.

@ALL - Thanks, learned a bunch about gui's!!

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

nitekram,

You do not provide a way to exit the script, is this your intent? If so, you may want to enforce a single instance of this script running.

kylomas

Unless you turn off the feature - you can always close your scrip by clicking on the AutoIt icon next to your time at bottom right of your screen, and hit the exit - in this snippet, I was only showing what was happening - in my script, there is a hotkey that also closes the script. I should have just made a small example rather then having all the rest of the snuff that is shown - sorry about that.

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...