Jump to content

Checking the value of a checkbox


Recommended Posts

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

  • Developers

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

....

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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