Sign in to follow this  
Followers 0
Jussip

Return to previous GUI

14 posts in this topic

Hey againg =)

I made a gui, and when pressed a button on it, it pops another gui. And when i try to close the popped gui, both gui's close, how i can put so that both wont close?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hello,

You need to open the second gui with a func. Ill give a short example.

#include <GUIConstantsEx.au3>

$GUI = GUICreate()
$Button1 = GUICtrlCreateButton()

GUISetState()
While 1
    $nMsg = GUIGetMsg()
    Select
    Case $nMsg = $GUI_EVENT_CLOSE
        Exit
    Case $nMsg = $Button1
        _SecondGUI()
    EndSelect
WEnd

Func _SecondGUI()
    GUISetState(@SW_DISABLE, $GUI)

    $GUI2 = GUICreate()
    $Button2 = GUICtrlCreateButton()

    GUISetState()
    While 2
        $nMsg2 = GUIGetMsg()
        Select
        Case $nMsg2 = $GUI_EVENT_CLOSE
            ExitLoop
        Case $nMsg2 = $Button1
            ; Do some stuff
        EndSelect
    WEnd

    GUIDelete($GUI2)
    GUISetState(@SW_ENABLE, $GUI)
    GUISetState(@SW_RESTORE, $GUI)
EndFunc

Hope it helps!

AlmarM

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

Hey againg =)

I made a gui, and when pressed a button on it, it pops another gui. And when i try to close the popped gui, both gui's close, how i can put so that both wont close?

Something like this?

$GUI1 = GUICreate("GUI1", 100, 100)
$NEW = GUICtrlCreateButton("NEW",25,25,50,50)
GUISetState(@SW_SHOW,$GUI1)

While 1
    $MSG = GUIGetMsg(1)
    Switch $MSG[0]
        Case $NEW
            GUISetState(@SW_DISABLE,$GUI1)
            $GUI2 = GUICreate("GUI2",200,200)
            GUISetState(@SW_SHOW,$GUI2)
        Case -3
            If $MSG[1] = $GUI1 Then Exit
            GUISetState(@SW_ENABLE,$GUI1)
            GUIDelete($GUI2)
    EndSwitch
WEnd

When the words fail... music speaks

Share this post


Link to post
Share on other sites

Hello,

You need to open the second gui with a func. Ill give a short example.

#include <GUIConstantsEx.au3>

$GUI = GUICreate()
$Button1 = GUICtrlCreateButton()

GUISetState()
While 1
    $nMsg = GUIGetMsg()
    Select
    Case $nMsg = $GUI_EVENT_CLOSE
        Exit
    Case $nMsg = $Button1
        _SecondGUI()
    EndSelect
WEnd

Func _SecondGUI()
    GUISetState(@SW_DISABLE, $GUI)

    $GUI2 = GUICreate()
    $Button2 = GUICtrlCreateButton()

    GUISetState()
    While 2
        $nMsg2 = GUIGetMsg()
        Select
        Case $nMsg2 = $GUI_EVENT_CLOSE
            ExitLoop
        Case $nMsg2 = $Button1
            ; Do some stuff
        EndSelect
    WEnd

    GUIDelete($GUI2)
    GUISetState(@SW_ENABLE, $GUI)
    GUISetState(@SW_RESTORE, $GUI)
EndFunc

Hope it helps!

AlmarM

all that effort and it doesn't even work!!!...???

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

all that effort and it doesn't even work!!!...???

8)

What do you mean it doesnt work??

AlmarM

EDIT:

Tested and it seems to work for me :)

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

What do you mean it doesnt work??

AlmarM

did you actually test it????

as "one" example

$GUI = GUICreate()

this line errors for me

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

What do you mean it doesnt work??

AlmarM

He wanted to say it was better a completely code. Not GuiCreate() and GuiCtrlCreateButton().

When the words fail... music speaks

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Hello,

You need to open the second gui with a func. Ill give a short example.

#include <GUIConstantsEx.au3>

$GUI = GUICreate()
$Button1 = GUICtrlCreateButton()

GUISetState()
While 1
    $nMsg = GUIGetMsg()
    Select
    Case $nMsg = $GUI_EVENT_CLOSE
        Exit
    Case $nMsg = $Button1
        _SecondGUI()
    EndSelect
WEnd

Func _SecondGUI()
    GUISetState(@SW_DISABLE, $GUI)

    $GUI2 = GUICreate()
    $Button2 = GUICtrlCreateButton()

    GUISetState()
    While 2
        $nMsg2 = GUIGetMsg()
        Select
        Case $nMsg2 = $GUI_EVENT_CLOSE
            ExitLoop
        Case $nMsg2 = $Button1
            ; Do some stuff
        EndSelect
    WEnd

    GUIDelete($GUI2)
    GUISetState(@SW_ENABLE, $GUI)
    GUISetState(@SW_RESTORE, $GUI)
EndFunc

Hope it helps!

AlmarM

uhh ok

Edited by Jussip

Share this post


Link to post
Share on other sites

EDIT:

Tested and it seems to work for me :)

What version of Autoit are you running?

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

He wanted to say it was better a completely code. Not GuiCreate() and GuiCtrlCreateButton().

Thats right...

Even better, if the OP would shows us the code that erorred on him, then we could adjust his code...

but we just get "uhh ok"

geeze

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

He wanted to say it was better a completely code. Not GuiCreate() and GuiCtrlCreateButton().

Oh, well.

What do you/he think about this :)?

#include <GUIConstantsEx.au3>

$GUI = GUICreate("2nd GUI Example", 100, 80)
$Button1 = GUICtrlCreateButton("Open GUI", 10, 10, 80)

GUISetState()
While 1
    $nMsg = GUIGetMsg()
    Select
    Case $nMsg = $GUI_EVENT_CLOSE
        Exit
    Case $nMsg = $Button1
        _SecondGUI()
    EndSelect
WEnd

Func _SecondGUI()
    GUISetState(@SW_DISABLE, $GUI)

    $GUI2 = GUICreate("2nd GUI Example", 100, 80)
    $Button2 = GUICtrlCreateButton("Close GUI", 10, 50, 80)

    GUISetState()
    While 2
        $nMsg2 = GUIGetMsg()
        Select
        Case $nMsg2 = $GUI_EVENT_CLOSE
            ExitLoop
        Case $nMsg2 = $Button2
            ExitLoop
        EndSelect
    WEnd

    GUIDelete($GUI2)
    GUISetState(@SW_ENABLE, $GUI)
    GUISetState(@SW_RESTORE, $GUI)
EndFunc

AlmarM


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Thats right...

Even better, if the OP would shows us the code that erorred on him, then we could adjust his code...

but we just get "uhh ok"

geeze

8)

Haha true!

AlmarM

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

Oh, well.

What do you/he think about this :) ?

...

AlmarM

Much, much better... now just learn to use "Tidy" and make it real clean

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

all go check my new post..

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