Sign in to follow this  
Followers 0
NSearch

Checking the value of a checkbox

2 posts in this topic

#1 ·  Posted (edited)

How do I check the value of a checkbox in a conditional statement. Here is the code that I currently have.

Thank you.

#include <GUIConstants.au3>

GUICreate("Report Generator",300,200)

$filemenu = GuiCtrlCreateMenu ("File")

$fileitem = GuiCtrlCreateMenuitem ("Open...",$filemenu)

$recentfilesmenu = GuiCtrlCreateMenu ("Recent Files",$filemenu)

$separator1 = GuiCtrlCreateMenuitem ("",$filemenu)

$exititem = GuiCtrlCreateMenuitem ("Exit",$filemenu)

;;;;;;;;;;;chech boxes;;;;;;;;;;;;;;;;;;;;;;

GuiCtrlCreateGroup("Selection Group", 50, 20)

GuiCtrlCreateCheckbox("Seperate by Shipper", 60, 35, 120)

$value1 = GuiCtrlSetState(-1, $GUI_CHECKED)

GuiCtrlCreateCheckbox("Run State Reports", 60, 60, 120)

$value2 = GuiCtrlSetState(-1, $GUI_CHECKED)

GuiCtrlCreateCheckbox("Run Weight Reports", 60, 85, 120)

$value3 = GuiCtrlSetState(-1, $GUI_CHECKED)

GuiCtrlCreateCheckbox("CD's to Client", 60, 110, 120)

$value4 = GuiCtrlSetState(-1, $GUI_CHECKED)

GUICtrlCreateGroup ("",-99,-99,1,1) ;close group

;CDTray("d:", "open")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

$okbutton = GuiCtrlCreateButton ("OK",50,140,70,20)

$cancelbutton = GuiCtrlCreateButton ("Cancel",180,140,70,20)

GuiSetState()

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton

ExitLoop

Case $msg = $fileitem

$file = FileOpenDialog("Choose file...",@MyDocumentsDir,"All (*.*)")

If @error <> 1 Then GuiCtrlCreateMenuItem ($file,$recentfilesmenu)

Case $msg = $exititem

ExitLoop

Case $msg = $okbutton

if $value1 = 1 Then

MsgBox(0, "Click","You checked Seperate by shipper!")

EndIf

if $value2 = 1 Then

MsgBox(0, "Click","You checked State!")

EndIf

if $value3 = 1 Then

MsgBox(0, "Click","You checked Weight!")

EndIf

if $value4 = 1 Then

MsgBox(0, "Click","You checked CD!")

EndIf

EndSelect

WEnd

GUIDelete()

Exit

Edited by NSearch

Share this post


Link to post
Share on other sites



How do I check the value of a checkbox in a conditional statement. Here is the code that I currently have.

Thank you.

<{POST_SNAPBACK}>

$value1 = GuiCtrlCreateCheckbox("Seperate by Shipper", 60, 35, 120)

GuiCtrlSetState(-1, $GUI_CHECKED)

If GuiCtrlread($Value1) = $GUI_Checked Then

....


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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