Jump to content

GUI Help Please


Recommended Posts

#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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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