Jump to content

Buttons in GUI


Recommended Posts

hope it helps

Opt ("GUINotifyMode", 1)
GUICreate("Select the Building:", 120, 100)

$OK = GUISetControl ("button", "OK", 10,10,50,20)
$Exit = GuisetControl ("button", "Exit", 10,40,50,20)

While 1
$N=GuiMsg ()


SELECT 
Case $n = $OK
Msgbox(0,0,"ok button has been pressed")

Case $n = $Exit
Msgbox(0,0,"EXIT button has been pressed")
   Exit
 EndSelect
WEnd
GUIHide()
Link to comment
Share on other sites

  • 2 weeks later...

Opt ("GUINotifyMode", 1)

GUICreate("Select the Building:", 120, 100)

$OK = GUISetControl ("button", "OK", 10,10,50,20)

$Exit = GuisetControl ("button", "Exit", 10,40,50,20)

While 1

$N=GuiMsg ()

SELECT

Case $n = $OK

Msgbox(0,0,"ok button has been pressed")

Case $n = $Exit

Msgbox(0,0,"EXIT button has been pressed")

  Exit

EndSelect

WEnd

GUIHide() 

When I try this $n always = '-2'.

Here is my code. The MsgBox's are there for me to see what's happening...

; NetMsg.au3
; August 5, 2004

; A NetSend Utility

GUICreate("NetMsg / A NetSend Utility", 300, 200)
  GUISetControl("Label", "Username:", 10, 10)
  $user = GUISetControl("Input", "Username", 10, 25)
  GUISetControl("Label", "Message:", 10, 60)
  $msg = GUISetControl("Input", "Type your message here", 10, 75, 280)
  $netsend = GUISetControl("Button", "Send", 10, 110, 100)
  $quit = GUISetControl("Button", "Exit", 190, 110, 100)
GUIShow()
GUIWaitClose()

While 1
  $x = GuiMsg()
  MsgBox(0, "$x", $x)

  Select
  Case $x = $netsend
    MsgBox(0, "$user", $user)
    MsgBox(0, "$msg", $msg)
    RunWait(@ComSpec & " /c " & "netsend " & $user & " " & $msg, "", @SW_HIDE)

  Case $x = $quit
    Exit
  EndSelect
WEnd

Thanks for any help,

Ian

"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Link to comment
Share on other sites

@ioliver:

You have to use:

Opt ("GUINotifyMode", 1)

Or should be use:

GUISetControlNotify() after setting the button controls.

One of these you sould take.

AND: delete the line with "GUIWaitCLose()"!!!

Regards Holger

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