Jump to content
Sign in to follow this  
Aces

GUI Help Please

Recommended Posts

Aces

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)

GUICreate("Aces GUI", 300, 400)

GUICtrlCreateLabel("This is Aces amateur autoit v3 GUI", 30, 10)

$GUIButton = GUICtrlCreateButton("Click it!", 30, 30)

GUICtrlSetOnEvent($GUIButton, "button")

GUISetState(@SW_Show)

Sleep(5000)

Func button()

MsgBox(0, "Aces Button", "Yay you clicked the button!")

EndFunc

I want the box to stay open, it automatically closes after the sleep time.

How do I keep it open until I close it myself?


~~ AutoIt v3 Minion ~~Name: Kevin "Aces-X" MorrisOrganization: A C DevelopmentE-Mail: AcesX91@acecoding.netOS: XP Professional; Vista package~~ Released Software ~~CPU-Mach: Topic at acecoding.net ForumsProxyzBuddy: Beta testing at the moment, private onlyWHSTool: Not released to the public

Share this post


Link to post
Share on other sites
poisonkiller

EDIT: Look below for Manadar's solution, I didn't see GUIOnEventOption.

Edited by poisonkiller

Share this post


Link to post
Share on other sites
jvanegmond

I am assuming you have a good reason for using the event mode. Otherwise, you should consider doing it the default way.

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)

GUICreate("Aces GUI", 300, 400)
GUICtrlCreateLabel("This is Aces amateur autoit v3 GUI", 30, 10)
$GUIButton = GUICtrlCreateButton("Click it!", 30, 30)
GUICtrlSetOnEvent($GUIButton, "button")
GUISetState(@SW_SHOW)
GUISetOnEvent($GUI_EVENT_CLOSE,"Close")

While 1
    Sleep(500)
WEnd

Func button()
    MsgBox(0, "Aces Button", "Yay you clicked the button!")
EndFunc   ;==>button

Func Close()
    Exit
EndFunc

Share this post


Link to post
Share on other sites
poisonkiller

Wooops, didn't see it. Edited my post too.

Share this post


Link to post
Share on other sites
Aces

Would using the default be simpler? and if so a little point in the right direction please? thank you guys


~~ AutoIt v3 Minion ~~Name: Kevin "Aces-X" MorrisOrganization: A C DevelopmentE-Mail: AcesX91@acecoding.netOS: XP Professional; Vista package~~ Released Software ~~CPU-Mach: Topic at acecoding.net ForumsProxyzBuddy: Beta testing at the moment, private onlyWHSTool: Not released to the public

Share this post


Link to post
Share on other sites
Aces

To create a new control on an existing tabitem use GUISwitch($hWin,$tabitem) to select it and just create your new control. Don't forget to close your tabitem creation with GUICtrlCreateTabItem("").

Is this how you add a GUICtrl into a tab that you have up?


~~ AutoIt v3 Minion ~~Name: Kevin "Aces-X" MorrisOrganization: A C DevelopmentE-Mail: AcesX91@acecoding.netOS: XP Professional; Vista package~~ Released Software ~~CPU-Mach: Topic at acecoding.net ForumsProxyzBuddy: Beta testing at the moment, private onlyWHSTool: Not released to the public

Share this post


Link to post
Share on other sites
jvanegmond

Would using the default be simpler? and if so a little point in the right direction please? thank you guys

#include <GUIConstants.au3>

GUICreate("Aces GUI", 300, 400)
GUICtrlCreateLabel("This is Aces amateur autoit v3 GUI", 30, 10)
$GUIButton = GUICtrlCreateButton("Click it!", 30, 30)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
         Case $GUI_EVENT_CLOSE
               Exit
         Case $GUIButton
               MsgBox(0, "Aces Button", "Yay you clicked the button!")
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
jvanegmond

Is this how you add a GUICtrl into a tab that you have up?

Yes, it is. You ask your questions well.

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  

×