plz help

09/16/2015 18:13 boy15#1
Code:
#RequireAdmin
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 319, 216, 192, 124)
$Checkbox1 = GUICtrlCreateCheckbox(" 1", 48, 56, 97, 17)
$Checkbox2 = GUICtrlCreateCheckbox(" 2", 48, 88, 97, 17)
$Checkbox3 = GUICtrlCreateCheckbox(" 4", 48, 120, 97, 17)
$Checkbox4 = GUICtrlCreateCheckbox(" 8", 216, 56, 97, 17)
$Checkbox5 = GUICtrlCreateCheckbox("16", 216, 88, 97, 17)
$Checkbox6 = GUICtrlCreateCheckbox(" 32", 216, 120, 97, 17)
$Button1 = GUICtrlCreateButton("plus any checked boxes", 64, 160, 155, 25)
GUISetState(@SW_SHOW)

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
			
		case $Button1

		????????????????????????????????????????????????????????; show result of plus checked boxes in message

	EndSwitch
WEnd
09/16/2015 20:49 alpines#2
I don't know whats worse, the fact that your title is garbage or the fact that you don't give a shit about rules >> [Only registered and activated users can see links. Click Here To Register...]
09/16/2015 21:16 [Beatrice]#3
Well, its not the best usage but you could make an if statement for every checkbox, read it, add into a variable and etc.

I guess this is what you are asking for.

Code:
#RequireAdmin
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 319, 216, 192, 124)
$Checkbox1 = GUICtrlCreateCheckbox("1", 48, 56, 97, 17)
$Checkbox2 = GUICtrlCreateCheckbox("2", 48, 88, 97, 17)
$Checkbox3 = GUICtrlCreateCheckbox("4", 48, 120, 97, 17)
$Checkbox4 = GUICtrlCreateCheckbox("8", 216, 56, 97, 17)
$Checkbox5 = GUICtrlCreateCheckbox("16", 216, 88, 97, 17)
$Checkbox6 = GUICtrlCreateCheckbox("32", 216, 120, 97, 17)
$Button1 = GUICtrlCreateButton("plus any checked boxes", 64, 160, 155, 25)
GUISetState(@SW_SHOW)

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
			
		 Case $Button1
			$plus = 0
			$plus = CheckCheckbox($Checkbox1,$plus)
			$plus = CheckCheckbox($Checkbox2,$plus)
			$plus = CheckCheckbox($Checkbox3,$plus)
			$plus = CheckCheckbox($Checkbox4,$plus)
			$plus = CheckCheckbox($Checkbox5,$plus)
			$plus = CheckCheckbox($Checkbox6,$plus)
			MsgBox(64,"Calculated",$plus)
	EndSwitch
WEnd

Func CheckCheckbox($Control,$Before)
If GUICtrlRead($Control) = 1 Then
$res = GUICtrlRead($Control,1)
Else
$res = 0
EndIf
Return $res + $Before
EndFunc
09/17/2015 04:15 boy15#4
thanks my sir
09/17/2015 10:41 Lawliet#5
[Only registered and activated users can see links. Click Here To Register...]

Quote:
  • Scriptrequests: Do ask for scripts there: [Only registered and activated users can see links. Click Here To Register...]
  • If you have a little question you have to ask there: [Only registered and activated users can see links. Click Here To Register...]
  • Thread with titels like: "Help!!", "Problem", "Question?!", "Autoit Question" are forbidden.
#closed