Jump to content

GUI Child Windows


Idea
 Share

Recommended Posts

Fix so the windows close..?

command or question?

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

If you want your other pop-up windows to be child windows, you have to reference the parent window name within the GUICreate() function.

To allow your child windows actually function when you create them, try using GUISwitch() to switch to the opened windows.

Link to comment
Share on other sites

  • Moderators

I was bored... so see if this will help:

#include <GUIConstants.au3>

$p = GUICreate(" Sign In/Out", 120, 80, -1, -1);, $WS_POPUP)

$btnIn = GUICtrlCreateButton ("Sign In",  0, 30, 50)
$btnOut = GUICtrlCreateButton ( "Sign Out",  60+10, 30, 50)

GUISetState()

While 1
    $MSG = GUIGetMsg()
    Select
    Case $MSG = $GUI_EVENT_CLOSE
        Exit
    Case $MSG = $BTNIN
        GUISetState(@SW_DISABLE, $P)
        btnIn()
        GUISetState(@SW_SHOW, $P)
        GUISetState(@SW_ENABLE, $P)
    Case $MSG = $BTNOUT
        GUISetState(@SW_DISABLE, $P)
        btnOut()
        GUISetState(@SW_SHOW, $P)
        GUISetState(@SW_ENABLE, $P)
    EndSelect
WEnd

Func btnIn()
$cIn = GUICreate(" Sign In", 280, 100, -1, -1);, $WS_POPUP)  

GUICtrlCreateLabel  ("Full name:",  10, 10, 50);first cell 50 width
$myedit=GUICtrlCreateEdit ("name", 10+50,  10, 200, 20, $ES_WANTRETURN); next line

GUICtrlCreateLabel  (" Activity:",  10, 40, 60)  
$myedit2=GUICtrlCreateEdit ("activity", 10+60,  40, 200, 20, $ES_WANTRETURN); next line

$btnOk = GUICtrlCreateButton ("Sign In",  90, 70, 50)
$btnCancel = GUICtrlCreateButton ( "Cancel",  90*2, 70, 70)


GUISetState (@SW_SHOW)   ; will display an empty dialog box

While 1
    $MSG1 = GUIGetMsg()
    Select
    Case $MSG1 = $GUI_EVENT_CLOSE
        Exit
    Case $MSG1 = $BTNOK
   ;DO SOMETHING
        GUIDelete($CIN)
        ExitLoop
    Case $MSG1 = $BTNCANCEL
   ;DO SOMETHING
        GUIDelete($CIN)
        ExitLoop
    EndSelect
WEnd

EndFunc

Func btnOut()
$cOut = GUICreate(" Sign Out", 280, 100, -1, -1);, $WS_POPUP)

GUICtrlCreateLabel  ("Full name:",  10, 10, 50);first cell 50 width
$myedit=GUICtrlCreateEdit ("name", 10+50,  10, 200, 20, $ES_WANTRETURN); next line


$btnOk = GUICtrlCreateButton ("Sign Out",  90, 70, 50)
$btnCancel = GUICtrlCreateButton ( "Cancel",  90*2, 70, 70)


GUISetState (@SW_SHOW)   ; will display an empty dialog box

While 1
    $MSG2 = GUIGetMsg()
    Select
    Case $MSG2 = $GUI_EVENT_CLOSE
        Exit
    Case $MSG2 = $BTNOK
   ;DO SOMETHING
        GUIDelete($COUT)
        ExitLoop
    Case $MSG2 = $BTNCANCEL
   ;DO SOMETHING
        GUIDelete($COUT)
        ExitLoop
    EndSelect
WEnd

EndFunc

WinWaitActive("help")

Edit: Forgot to take out your last GuiSetState().. wasn't needed.

Edited by ronsrules

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

I don't use events... so I took them out in my example... but if you figured it out.. why don't you post your script to help others that might be looking for the answer to your same question.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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