netegg
发表于 2011-4-26 16:22:45
想的大概明白了,完全属个人想多了,不好意思,大家不用费脑子了,和单选一样
mo_shaojie
发表于 2011-4-26 22:54:29
这个好玩,试下。
蛋蛋别喷我。
3mile 发表于 2011-4-26 10:04 http://www.autoitx.com/images/common/back.gif
呵呵,3mile这个有点意思.把全选的推荐都打勾了看看.再去掉推荐的勾再看看.哈.完全无反应的.这下有意思了.{:face (303):}
mo_shaojie
发表于 2011-4-26 22:57:24
呵呵,3mile这个有点意思.把全选的推荐都打勾了看看.再去掉推荐的勾再看看.哈.完全无反应的.这下有意思了. ...
mo_shaojie 发表于 2011-4-26 22:54 http://www.autoitx.com/images/common/back.gif
不好意思,想错了.应该是正确的.
mo_shaojie
发表于 2011-4-27 10:22:48
还有一种效果就是点击全选选框,全部选上,推荐选框的勾自动去掉,再点击推荐选框,选上推荐的选框,全选复选框的勾去掉.有点互不干忧的做法.
3mile
发表于 2011-4-27 12:55:53
注释掉47-49,54-56行
mo_shaojie
发表于 2011-4-27 15:33:44
注释掉47-49,54-56行
3mile 发表于 2011-4-27 12:55 http://www.autoitx.com/images/common/back.gif
这个是什么意思?如果这样的话,效果大不一样的了.你可以看下是什么问题了.
netegg
发表于 2011-4-27 17:40:45
本帖最后由 netegg 于 2011-4-27 22:05 编辑
忽然想到一个问题,楼主的全选和推荐操作是单向的,只管选不管读吧,具体的操作应该是其它复选的事情
虽说有点绕,楼主看看这段代码,肯定是没写对,不过可能可以参考一下#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <array.au3>
;Global Const $GUI_CHECKED = 1
;Global Const $GUI_INDETERMINATE = 2
;Global Const $GUI_UNCHECKED = 4
Dim $Checkbox
Dim $choose = _arraycreate(2, 5, 6, 7)
Dim $sChoose = '2,5,6,7'
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
For $i = 1 To 18
$Checkbox[$i] = GUICtrlCreateCheckbox("Checkbox" & $i, 48, 32 + 16 * ($i - 1), 97, 17)
Next
$Checkbox = GUICtrlCreateCheckbox("推荐", 392, 312, 97, 17)
$Checkbox = GUICtrlCreateCheckbox("全选", 392, 352, 97, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
If $nMsg = $GUI_EVENT_CLOSE Then Exit
For $i = 1 To 20
If $nMsg = $Checkbox[$i] Then
;判断推荐复选
If $i = 19 Then
For $j In $choose
GUICtrlSetState($Checkbox[$j], GUICtrlRead($Checkbox))
Next
For $j = 1 To 18
If GUICtrlRead($Checkbox[$j]) = 4 Then
GUICtrlSetState($Checkbox, 4)
EndIf
Next
ElseIf $i = 20 Then ;判断全选复选
For $j = 1 To 19
GUICtrlSetState($Checkbox[$j], GUICtrlRead($Checkbox))
Next
ElseIf Not ($i = 19 Or $i = 20) Then ;判断一般复选
GUICtrlSetState($Checkbox, GUICtrlRead($Checkbox[$i]))
If StringInStr($sChoose, $i) Then GUICtrlSetState($Checkbox, GUICtrlRead($Checkbox[$i]))
For $j = 1 To 18
;检查所有一般复选
If GUICtrlRead($Checkbox[$j]) = 4 Then
GUICtrlSetState($Checkbox, 4) ; 取消全选复选
If StringInStr($sChoose, $j) Then GUICtrlSetState($Checkbox, 4)
EndIf
Next
EndIf
EndIf
Next
WEnd
补齐了,试试看对不对
netegg
发表于 2011-4-28 04:08:07
本帖最后由 netegg 于 2011-4-28 07:45 编辑
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <array.au3>
Dim $Checkbox
Dim $sChoose = '2,5,6,7'
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
For $i = 1 To 18
$Checkbox[$i] = GUICtrlCreateCheckbox("Checkbox" & $i, 48, 32 + 16 * ($i - 1), 97, 17)
Next
$Checkbox = GUICtrlCreateCheckbox("推荐", 392, 312, 97, 17)
$Checkbox = GUICtrlCreateCheckbox("全选", 392, 352, 97, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
If $nMsg = $GUI_EVENT_CLOSE Then Exit
For $i = 1 To 20
If $nMsg = $Checkbox[$i] Then
Switch $i
Case 19, 20
If $i = 19 Then
GUICtrlSetState($Checkbox, GUICtrlRead($Checkbox))
For $j In $choose
GUICtrlSetState($Checkbox[$j], GUICtrlRead($Checkbox))
Next
Else
For $j = 1 To 19
GUICtrlSetState($Checkbox[$j], GUICtrlRead($Checkbox))
Next
EndIf
For $j = 1 To 18
If GUICtrlRead($Checkbox[$j]) = 4 ThenGUICtrlSetState($Checkbox, 4)
Next
Case Else ;判断一般复选
GUICtrlSetState($Checkbox, GUICtrlRead($Checkbox[$i]))
If StringInStr($sChoose, $i) Then GUICtrlSetState($Checkbox, GUICtrlRead($Checkbox[$i]))
For $j = 1 To 18
;检查所有一般复选
If GUICtrlRead($Checkbox[$j]) = 4 Then
GUICtrlSetState($Checkbox, 4) ; 取消全选复选
If StringInStr($sChoose, $j) Then GUICtrlSetState($Checkbox, 4)
EndIf
Next
EndSwitch
EndIf
Next
WEnd
再试试,简化了些
mo_shaojie
发表于 2011-4-28 08:43:18
已经知道了,多谢各位的给力.很感激.
cykefu
发表于 2011-4-29 03:38:09
学习了,坛子里高手就是多
zcx880517
发表于 2011-4-29 08:49:00
用单选框就好搞定的。
netegg
发表于 2011-4-29 10:42:46
回复 41# zcx880517
错了,全选选上必然推荐选上,不可能用单选
djfei007
发表于 2011-4-30 09:25:53
新手学习一下
dnvplj
发表于 2015-6-21 20:37:34
回复 7# 水木子
请问,全不选怎么做,谢谢了。