Sign in to follow this  
Followers 0
2words4uready

Kinda Lost

8 posts in this topic

ive got my gui but have no idea how to make it function

could someone post a simple example


READ BEFORE POSTINGMy UDF'sMessagesYou say plz because its shorter than please. I say no because its shorter than yes.Join My Website

Share this post


Link to post
Share on other sites



2words4uready

More details.

Share this post


Link to post
Share on other sites

2words4uready

More details.

how do you make a button actually function like if the user presses the button a message box pops up

READ BEFORE POSTINGMy UDF'sMessagesYou say plz because its shorter than please. I say no because its shorter than yes.Join My Website

Share this post


Link to post
Share on other sites

how do you make a button actually function like if the user presses the button a message box pops up

From the Help file:

#include <GUIConstantsEx.au3>

GUICreate("Hello World", 200, 100)
GUICtrlCreateLabel("Hello world! How are you?", 30, 10)
$okbutton = GUICtrlCreateButton("OK", 70, 50, 60)
GUISetState(@SW_SHOW)

While 1
  $msg = GUIGetMsg()

  Select
    Case $msg = $okbutton
      MsgBox(0, "GUI Event", "You pressed OK!")

    Case $msg = $GUI_EVENT_CLOSE
      MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...")
      ExitLoop
  EndSelect
WEnd

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Or in OnEventMode

#include <GUIConstantsEx.au3>
Opt('GuiOnEventMode',1)
GUICreate("Hello World", 200, 100)
GuiSetOnEvent($GUI_EVENT_CLOSE, "Quit")
GUICtrlCreateLabel("Hello world! How are you?", 30, 10)
$okbutton = GUICtrlCreateButton("OK", 70, 50, 60)
GuiCtrlSetOnEvent(-1, "Button")
GUISetState(@SW_SHOW)

While 1
Sleep(100)
WEnd

Func Quit()
Exit
EndFunc

Func Button()
MsgBox(0, "", "You pressed the button!")
EndFunc
Edited by Paulie

Share this post


Link to post
Share on other sites

From the Help file:

#include <GUIConstantsEx.au3>

GUICreate("Hello World", 200, 100)
GUICtrlCreateLabel("Hello world! How are you?", 30, 10)
$okbutton = GUICtrlCreateButton("OK", 70, 50, 60)
GUISetState(@SW_SHOW)

While 1
  $msg = GUIGetMsg()

  Select
    Case $msg = $okbutton
      MsgBox(0, "GUI Event", "You pressed OK!")

    Case $msg = $GUI_EVENT_CLOSE
      MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...")
      ExitLoop
  EndSelect
WEnd
im still lost could someone comment the above code and tell me what it does

READ BEFORE POSTINGMy UDF'sMessagesYou say plz because its shorter than please. I say no because its shorter than yes.Join My Website

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

#include <GUIConstantsEx.au3>

GUICreate("Hello World", 200, 100); Create the GUI
GUICtrlCreateLabel("Hello world! How are you?", 30, 10); Create the label
$okbutton = GUICtrlCreateButton("OK", 70, 50, 60); This creates the button. Notice the variable, $okbutton
GUISetState(@SW_SHOW); Make the GUI visible

While 1 ; Start a loop to keep the GUI visible while it checks to see what the user does
  $msg = GUIGetMsg(); Watch the GUI to see if the user does anything. Another variable, which will interact with the one above

  Select
    Case $msg = $okbutton; If the user clicks the OK button Then...
      MsgBox(0, "GUI Event", "You pressed OK!"); Display the message box

    Case $msg = $GUI_EVENT_CLOSE; If user click the GUI's close button Then...
      MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting..."); Display the message box
      ExitLoop; Get out of the loop that keeps the GUI visible
  EndSelect
WEnd

Edited by pete1234

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

#include <GUIConstantsEx.au3>

GUICreate("Hello World", 200, 100); Create the GUI
GUICtrlCreateLabel("Hello world! How are you?", 30, 10); Create the label
$okbutton = GUICtrlCreateButton("OK", 70, 50, 60); This creates the button. Notice the variable, $okbutton
GUISetState(@SW_SHOW); Make the GUI visible

While 1 ; Start a loop to keep the GUI visible while it checks to see what the user does
  $msg = GUIGetMsg(); Watch the GUI to see if the user does anything. Another variable, which will interact with the one above

  Select
    Case $msg = $okbutton; If the user clicks the OK button Then...
      MsgBox(0, "GUI Event", "You pressed OK!"); Display the message box

    Case $msg = $GUI_EVENT_CLOSE; If user click the GUI's close button Then...
      MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting..."); Display the message box
      ExitLoop; Get out of the loop that keeps the GUI visible
  EndSelect
WEnd
thank you so much i was always so lost when working with a gui but i get it now and my programming knowledge is really starting to grow with this language Edited by 2words4uready

READ BEFORE POSTINGMy UDF'sMessagesYou say plz because its shorter than please. I say no because its shorter than yes.Join My Website

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