Sign in to follow this  
Followers 0
Killer

Sub windows problem

3 posts in this topic

I am trying to open a sub window from a window. Instead of the usual msgbox I want one where I can have my own buttons. I create a sub window but having problem closing it. Can someone help me on the code?

#include <GUIConstants.au3>

GUICreate("My GUI edit")

$Button_2a=""

$Button_1 = GUICtrlCreateButton ("Run Notepad", 10, 30, 100)

$Button_2 = GUICtrlCreateButton ( "Button Test", 10, 120)

$myedit=GUICtrlCreateEdit ($Button_1& @CRLF, 176,32,121,97,$ES_AUTOVSCROLL+$WS_VSCROLL)

GUISetState ()

; will be append dont' forget 3rd parameter

GUICtrlSetData ($myedit, "Second line",1)

; Run the GUI until the dialog is closed

While 1

$msg = GUIGetMsg()

if $msg = $Button_1 then

GUICreate("2ndwind",150,150)

$Button_1a = GUICtrlCreateButton ("Run", 10, 30, 100)

$Button_2a = GUICtrlCreateButton ( "close", 10, 120)

GUISetState ()

endif

If $msg = $Button_2a and WinActive("2ndwind")=1 Then

GUIDelete("2ndwind")

msgbox(0,"","closeing")

endif

If $msg = $GUI_EVENT_CLOSE and WinActive("2ndwind")<>1 Then

exitloop

endif

Wend

Share this post


Link to post
Share on other sites



#include <GUIConstants.au3>

$main_gui = GUICreate("My GUI edit")
$Button_2a = ""

$Button_1 = GUICtrlCreateButton("Run Notepad", 10, 30, 100)
$Button_2 = GUICtrlCreateButton("Button Test", 10, 120)

$myedit = GUICtrlCreateEdit($Button_1 & @CRLF, 176, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL)

GUISetState()

; will be append dont' forget 3rd parameter
GUICtrlSetData($myedit, "Second line", 1)

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    Select
        Case $msg = $Button_1
            GUISetState(@SW_DISABLE, $main_gui)
            $child_gui = GUICreate("2ndwind", 150, 150)
            
            $Button_1a = GUICtrlCreateButton("Run", 10, 30, 100)
            $Button_2a = GUICtrlCreateButton("close", 10, 120)
            GUISetState()
            While 1
                $msg2 = GUIGetMsg()
                Select
                    Case $msg2 = $GUI_EVENT_CLOSE Or $msg2 = $Button_2a
                        ExitLoop
                EndSelect
            WEnd
            GUISetState(@SW_ENABLE, $main_gui)
            GUIDelete($child_gui)
            
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Thanks for the help! :)

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