Jump to content

Child window concepts


 Share

Recommended Posts

I want to know if I am on the right track, or if there is a better way to approach what I am trying to do.

-I have a situation where I will have a few different situations where I will have a child GUI in my application.

-There will only ever be one child window open at any given time.

What I'm wanting to know is should I be rebuilding the same $ChildGUI as I go, or should I be making a different

Child GUI for each use and/or page of each use that I need?

Code Framework:

#include <GUIConstants.au3>
HotKeySet("{ESC}", "MyESC")
Opt("GUIOnEventMode", 1) ; Change to OnEvent mode
$MainGUI = GUICreate("MainGUI", 200, 200)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSE_Clicked")
$menu_File = GUICtrlCreateMenu("&File")
$menu_Help = GUICtrlCreateMenu("&Help")
$menu_Exit = GUICtrlCreateMenuItem("Exit", $menu_File)
$menu_Tutorial = GUICtrlCreateMenuItem("Tutorial", $menu_Help)
$menu_About = GUICtrlCreateMenuItem("About", $menu_Help)
GUICtrlSetOnEvent($menu_Exit, "CLOSE_Clicked")
GUICtrlSetOnEvent($menu_About, "ABOUT_Clicked")
GUICtrlSetOnEvent($menu_Tutorial, "TUTORIAL_Clicked")
$ChildGUI = GUICreate("ChildGUI", 400, 400)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSE_Clicked")
GUISwitch($MainGUI)
GUISetState(@SW_SHOW, $MainGUI)
While 1
    Sleep(1000)
WEnd
Func TUTORIAL_Clicked()
    GUICtrlSetState($menu_About, $GUI_DISABLE)
    ; make $ChildGUI a tutorial (like a wizard)
    ; add labels images and next/exit buttons
    GUISetState(@SW_SHOW, $ChildGUI)
    ; reset $ChildGUI's look after each 'Next'
EndFunc   ;==>TUTORIAL_Clicked
Func ABOUT_Clicked()
    GUICtrlSetState($menu_About, $GUI_DISABLE)
    ; make $ChildGUI an 'about' window with
    ; an OK button
    GUISetState(@SW_SHOW, $ChildGUI)
EndFunc   ;==>ABOUT_Clicked
Func MyESC()
    ; do nothing (I don't like ESC exiting the program)
EndFunc   ;==>MyESC
Func CLOSE_Clicked()
    If @GUI_WinHandle = $MainGUI Then
        Exit
    Else
        GUISetState(@SW_HIDE, $ChildGUI)
        GUICtrlSetState($menu_About, $GUI_ENABLE)
        GUICtrlSetState($menu_Tutorial, $GUI_ENABLE)
    EndIf
EndFunc   ;==>CLOSE_Clicked

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

I would suggest making a different child gui for each of your situations.. rather than rebuilding it.

I have a script with 5 possible windows and they all work fine open at the same time. While I don't use OnEventMode, I dont see that being an issue for you.

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Link to comment
Share on other sites

Thanks Sim

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

$gui= GUICreate("Title", 380, 450, -1, -1, -1, $WS_EX_TOOLWINDOW, $parent)

I would suggest using something similar above for the child windows, noting that $parent = the name of the parent GUI.

My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic]

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