Sign in to follow this  
Followers 0
eleria

Problem switching between GUIs [SOLVED]

2 posts in this topic

#1 ·  Posted (edited)

Sorry, I solved the problem myself :)

Hello, I find using more than one window and switching between them very confusing... Please take a look at my gui

Once I use CTRL+L to bring the load window back, nothing on it works... the LOAD button, the CANCEL button, and even closing the gui with the system button

#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_compression=4
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <EditConstants.au3>

Const $GUI_RUNDEFMSG = 'GUI_RUNDEFMSG'
Const $GUI_EVENT_CLOSE = -3
Const $WM_LBUTTONDOWN = 0x201
Const $WM_PAINT = 0x000F
Const $WS_POPUP = 0x80000000
Const $C_BLACK = 0xFF000000
Const $C_TEXT = 0xAAAA00

;~ opt("mustdeclarevars", 1)

GUIRegisterMsg($WM_LBUTTONDOWN, "_WinMove")
HotKeySet("{Esc}", "_exit")
HotKeySet("^l", "_Load")

Dim $hgui

$isloaded = 0

$Spawn_Map = GUICreate("Spawn Map", 1232, 727, -1, -1, $WS_POPUP, 0)
GUISetBkColor($C_BLACK, $hgui)

$Load = GUICreate("Load ", 128, 96, 413, 322)
$In_geox = GUICtrlCreateInput("", 29, 34, 28, 21, BitOR($ES_CENTER, $ES_AUTOHSCROLL, $ES_NUMBER))
GUICtrlSetLimit(-1, 2)
$In_geoy = GUICtrlCreateInput("", 70, 34, 28, 21, BitOR($ES_CENTER, $ES_AUTOHSCROLL, $ES_NUMBER))
GUICtrlSetLimit(-1, 2)
$Buttonload = GUICtrlCreateButton("Load", 12, 61, 48, 28, 0)
$ButtonCancel = GUICtrlCreateButton("Cancel", 67, 61, 48, 28, 0)
$Label1 = GUICtrlCreateLabel("What region shall I load ?", 4, 5, 120, 17)
$Label2 = GUICtrlCreateLabel("_", 60, 38, 7, 17)

_Load()

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Buttonload
            If $isloaded Then
            ; DO STUFF

                GUISetState(@SW_HIDE, $Spawn_Map)

            EndIf
            
            ; DO STUFF

            GUISetState(@SW_DISABLE, $Load)
            GUISetState(@SW_HIDE, $Load)
            
            GUISetState(@SW_SHOW, $Spawn_Map)
            GUISwitch($Spawn_Map)
            WinActivate("Spawn Map")
            $isloaded = 1

            ; DO STUFF

    ;       While 1
                ; DO STUFF
    ;       WEnd
        Case $ButtonCancel
            Switch $isloaded
                Case 1
                    ; DO STUFF
                Case Else
                    Exit
            EndSwitch
    EndSwitch
WEnd

;###########################################################################
;#                              Functions                                  #
;###########################################################################

Func _WinMove($hwnd, $Command, $wParam, $lParam)
    If BitAND(WinGetState($hwnd), 32) Then Return $GUI_RUNDEFMSG
    DllCall("user32.dll", "int", "SendMessage", "hWnd", $hwnd, "int", 0x0112, "int", 0xF009, "int", 0)
EndFunc   ;==>_WinMove

Func _WinPaint()
    Switch $isloaded
        Case 1
            ; DO STUFF
    EndSwitch
EndFunc   ;==>_WinPaint

Func _exit()
    Switch $isloaded
        Case 1
            ; DO STUFF
    EndSwitch
    Exit
EndFunc   ;==>_exit

Func _Load()
    If $isloaded Then
        $isloaded = 0
        GUISetState(@SW_DISABLE, $Spawn_Map)
    EndIf

    GUISetState(@SW_SHOW, $Load)
    GUISetState(@SW_ENABLE, $Load)
    GUISwitch($Load)
EndFunc   ;==>_Load

EDIT : Removed useless stuff

Edited by eleria

Share this post


Link to post
Share on other sites

Use the search. See here

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