Jump to content
Sign in to follow this  
Cod3Monk3y

getting button click

Recommended Posts

i have an "Ok" and "Cancel" button and can't figure out how to figure out when one is clicked? I'm sure there's an On_Button_1_Click event, but i'm not sure how to get it. I've looked through all kinds of things, but still can't seem to find an answer.

Thanks in advance

Share this post


Link to post
Share on other sites

See the "CodeWizard" under SciTE Tools

#Region --- CodeWizard generated code Start ---
;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes, No, and Cancel, Icon=None, Timeout=10 ss
If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer
$iMsgBoxAnswer = MsgBox(3,"Message Box","Please respond",10)
Select
   Case $iMsgBoxAnswer = 6;Yes

   Case $iMsgBoxAnswer = 7;No

   Case $iMsgBoxAnswer = 2;Cancel

   Case $iMsgBoxAnswer = -1;Timeout

EndSelect
#EndRegion --- CodeWizard generated code End ---

8)

Share this post


Link to post
Share on other sites

Valuater showed you the answer for a msgbox, here's another for a gui

#include <GuiConstants.au3>

GuiCreate("MyGUI", 392, 323)

$Button_1 = GuiCtrlCreateButton("OK", 90, 260, 80, 30)
$Button_2 = GuiCtrlCreateButton("Cancel", 230, 260, 80, 30)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_1
        MsgBox(0,"Button", "Ok selected")
    Case $msg = $Button_2
        MsgBox(0,"Button", "Cancel selected")
    EndSelect
WEnd
Exit

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Thanx for the quick responses, actually figured it out after i hit submit.

I do have another question.

Once I've gotten that the user hit the okay button how to I check to see which checkboxes and radio buttons are selected?

Share this post


Link to post
Share on other sites

USE...

#include <GUIConstants.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("AForm1")
$ck1 = GUICtrlCreateCheckbox("Helper", 40, 56, 81, 85)
$btn = GUICtrlCreateButton( "test check box", 40, 156, 80, 35) 
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $btn
        If BitAnd(GUICtrlRead($ck1),$GUI_CHECKED) = $GUI_CHECKED then MsgBox(64, "Test", "Box is Checked", 5)
    Case Else
       ;;;;;;;
    EndSelect
WEnd
Exit

8)

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  

×
×
  • Create New...