Jump to content
Sign in to follow this  
mcclane654

buttons and gui_event_Close

Recommended Posts

mcclane654

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>

Global $enableinput2 = 1
Global $meldinger = 1
Func Menu()
GUICreate ("", 500, 200)
GUISetState()
$messagesmenu = GUICtrlCreateMenu("Messages")
$optionsmenu = GUICtrlCreateMenu("Options")
$defaultsettings = GUICtrlCreateMenuItem("Default settings", $messagesmenu,"",1)
GUICtrlSetState(-1, $GUI_CHECKED)
$Customsettings = GUICtrlCreateMenuItem("Custom settings", $messagesmenu,"",1)
$Enteratstart = GUICtrlCreateMenuItem("Enter at start", $messagesmenu,"",1)
$Options = GUICtrlCreateMenuItem("Options", $optionsmenu)
$button = GUICtrlCreateButton("Press to start", 200, 70, 100, 40)
Global $s
While $s = 0
    Local $msg = GUIGetMsg(1)
    Switch $msg[0]
        Case $button
            Start()
        Case $GUI_EVENT_CLOSE
            Exit("0")
        Case $defaultsettings
            Start2()
        Case $Customsettings
            MsgBox(64, "under construction", "coming soon")
        Case $Enteratstart
            MsgBox(64, "under construction", "coming soon")
        Case $Options
            $s=1
            options()
    EndSwitch
WEnd
EndFunc
Func Options()
    GUICreate("Options", 350, 500)
    GUISetState()
    GUICtrlCreateLabel("How many different messages?", 5,30)
    GUICtrlCreateInput("", 5, 50)
    GUICtrlCreateLabel("What should messages say?", 5,70)
    Local $melding[1]
    $melding[0] = GUICtrlCreateInput ("", 5,20*0+90)
GUICtrlCreateLabel("How many messages?", 5,20*0+110)
Global $antallmeldinger = GUICtrlCreateInput ("", 5,20*0+130)
$okbutton = GUICtrlCreateButton("Ok", 100, 450, 50, 30)
$closebutton = GUICtrlCreateButton("Close", 200, 450, 50, 30)
$msg1 = GUIGetMsg()
While 1
    Switch $msg1
        Case $closebutton
            MsgBox(64,"button test", "it works")
        Case $okbutton
            MsgBox(64,"button test", "it works")
        Case $GUI_EVENT_CLOSE
            MsgBox(64,"button test", "it works")
EndSwitch
WEnd
EndFunc

can any1 help mee find out why my buttons and close button dosen't respond in the second window Options() :(?

Share this post


Link to post
Share on other sites
kylomas

mcclane654,

Two things:

1 - functions start() and start2() are missing

2 - You don't actually execute anything.  You only have functions in your script.

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
mcclane654

This isen't the whole script! This is the part that i struggle with. So if you could help me make the msgbox pop up when the button is pressed i'll handle the rest myself ;)

Edited by mcclane654

Share this post


Link to post
Share on other sites
kylomas

Put your guigetmsg() inside the while loop. 


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
mcclane654

Can't belive i missed it  :shocked: thx

Share this post


Link to post
Share on other sites
mcclane654

now the buttons work but have can I fix it soo that when you press close it only closes the option gui :S?
I have tried:
 

WinKill("Options")
WinClose("Options")
Exit("0")

but when i press the buttons afterward they quit the whole script :( help?

Share this post


Link to post
Share on other sites
Melba23

mcclane654,

I recommend reading the Managing Multiple GUIs tutorial in the Wiki. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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  

×