Jump to content

Return to previous GUI


Jussip
 Share

Recommended Posts

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.

Link to comment
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.

Link to comment
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

Link to comment
Share on other sites

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.

Link to comment
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

uhh ok

Edited by Jussip
Link to comment
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.

Link to comment
Share on other sites

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.

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