Jump to content

Recommended Posts

Posted

I want to create second (child) window from Main (parent) window with control element (for example Button and List).

I can create second window, but there isn't control elemens.

Could help me anybody?

Best regards Nikita.

Luck, Love and PatienceNikita

Posted

Not 100% sure what you mean, but something like this?

#include <GUIConstants.au3>

$gui_1 = GUICreate('Window 1', 200, 30, @DesktopWidth / 2 - 100, @DesktopHeight / 2 - 100)
$btn_1 = GUICtrlCreateButton('Button 1', 10, 10, 180, 20)

$gui_2 = GUICreate('Window 2', 200, 30)
$btn_2 = GUICtrlCreateButton('Button 2', 10, 10, 180, 20)

GUISetState(@SW_SHOW, $gui_1)
GUISetState(@SW_SHOW, $gui_2)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $btn_1
            MsgBox(0, '', 'btn 1')
        Case $btn_2
            MsgBox(0, '', 'btn 2')
    EndSwitch
WEnd
Posted

Hmm... Very strange. Probably early I try to do this wrong. Ok! Thanks :). Now all it work.

However I'd like event conditions. I made over on the event, and that ok again :P

Thanks again.

Luck, Love and PatienceNikita

Posted

Another question :"> . How create new window with control element, by push button on previous window. Please in event mode. Sorry for my English

Luck, Love and PatienceNikita

Posted (edited)

Would you like fries with that?

#include <GUIConstants.au3>

Opt('GUIOnEventMode', 1)

GUICreate('Window 1', 200, 30, @DesktopWidth / 2 - 100, @DesktopHeight / 2 - 100)
GUISetOnEvent($GUI_EVENT_CLOSE, 'quit')

$btn_1 = GUICtrlCreateButton('Button 1', 10, 10, 180, 20)
GUICtrlSetOnEvent($btn_1, 'gui2')

GUISetState(@SW_SHOW)

While 1
    Sleep(100)
WEnd

Func gui2()
    If Not WinExists('Window 2') Then
        GUICreate('Window 2', 200, 30)
        GUISetOnEvent($GUI_EVENT_CLOSE, 'del')
        $btn_2 = GUICtrlCreateButton('Button 2', 10, 10, 180, 20)
        GUICtrlSetOnEvent($btn_2, 'btn2')
        GUISetState(@SW_SHOW)
    EndIf
EndFunc

Func btn2()
    MsgBox(0, '', 'btn2')
EndFunc

Func del()
    GUIDelete()
EndFunc

Func quit()
    Exit
EndFunc
Edited by xcal

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
×
×
  • Create New...