Sign in to follow this  
Followers 0
Madza91

Parent & Child GUI's | GUICloseOnESC ?

3 posts in this topic

#1 ·  Posted (edited)

Hi, i have 1 parent and 1 child GUI and i want to be for parent: GUICloseOnESC = 1, but for child GUICloseOnESC = 0, on ESC to close child, but parent no...how? ;/

(without hotkeyset)

#include <GUIConstants.au3>

;Opt("GUICloseOnESC", 0)

$gui = GUICreate("Form1", 633, 447, 193, 125)
GUISetState(@SW_SHOW)
child()

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Func child()
    GUISetState(@SW_DISABLE, $gui)
    $child2 = GUICreate("child", 277, 180, -1, -1, -1, $WS_EX_TOOLWINDOW, $gui)
    $edit = GUICtrlCreateButton("&OK",62,153,75,23, $BS_DEFPUSHBUTTON)
    $cancel = GUICtrlCreateButton("&Cancel",140,153,75,23)
    GUISetState()
    Do
        $msg1 = GUIGetMsg()
    Until $msg1 = $GUI_EVENT_CLOSE Or $msg1 = $cancel
        GUISetState(@SW_ENABLE, $gui)
    GUIDelete($child2)
EndFunc   ;==>edit
Edited by n3nE

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Share this post


Link to post
Share on other sites



Maybe try something like this

#include <GUIConstants.au3>

Opt("GUICloseOnESC", 1)

Global $child2, $edit, $cancel

$gui = GUICreate("Form1", 633, 447, 193, 125)
GUISetState(@SW_SHOW)

_Child()

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            If WinActive($child2) Then
                GUIDelete($child2)
                GUISetState(@SW_ENABLE,$gui)
                opt("GUICloseOnEsc",0)
            Else
                Exit
            EndIf
    EndSwitch
WEnd


Func _Child()
    GUISetState(@SW_DISABLE, $gui)
    $child2 = GUICreate("child", 277, 180, -1, -1, -1, $WS_EX_TOOLWINDOW, $gui)
    $edit = GUICtrlCreateButton("&OK",62,153,75,23, $BS_DEFPUSHBUTTON)
    $cancel = GUICtrlCreateButton("&Cancel",140,153,75,23)
    GUISetState()
EndFunc

Share this post


Link to post
Share on other sites

Yes, thank you :D


[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

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  
Followers 0