Jump to content

GUI Window Problem

Guest LiQUiDNiTrO

Recommended Posts

Guest LiQUiDNiTrO


I have a problem with my script. If a user clicks on Options->Settings they get a new GUI like they should. If they click on X, it closes the entire app. I just want it to close the settings window. I have tried using another While loop, but that just prevents it from coming up. Here is the code:

#include <GUIConstants.au3>

GUICreate("MyApp", 800, 600)         ; will create a dialog box that when displayed is centered
GUISetState (@SW_SHOW)    ; will display an empty dialog box

$filemenu = GuiCtrlCreateMenu ("File")
$exititem = GuiCtrlCreateMenuitem ("Exit", $filemenu)
$optionsmenu = GuiCtrlCreateMenu ("Options")
$settingsitem = GuiCtrlCreateMenuitem ("Settings", $optionsmenu)
$helpmenu = GuiCtrlCreateMenu ("Help")
$aboutitem = GuiCtrlCreateMenuitem ("About", $helpmenu)


While 1
    $msg = GUIGetMsg()

        Case $msg = $GUI_EVENT_CLOSE
        Case $msg = $exititem
        Case $msg = $settingsitem
            GUICreate("MyApp - Settings", 600, 450)      ; will create a dialog box that when displayed is centered 

            $okbutton = GuiCtrlCreateButton ("OK", 200, 425, 100, 20)
            $cancelbutton = GuiCtrlCreateButton ("Cancel", 300, 425, 100, 20)
            GUISetState ()
        Case $msg = $aboutitem
            Msgbox(0, "About", "GUI Menu Test")



This is probably a simple fix, but i'm new to AutoIt so i'm having some trouble figuring it out. I will pick up fast, as I know web scripting languages and some C/C++.



Edited by LiQUiDNiTrO
Link to comment
Share on other sites

Guest LiQUiDNiTrO

That works, but I get an error:

WARNING: $kid1: possibly used before declaration.

Also, when you close the settings window, the main window flashes.

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...