找回密码
 加入
搜索
查看: 2583|回复: 8

[AU3基础] 多个复选框-如果做判断是否选择 [已解决]

  [复制链接]
发表于 2011-12-15 16:36:12 | 显示全部楼层 |阅读模式
本帖最后由 872777825 于 2011-12-15 17:42 编辑
#RequireAdmin
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Process.au3>
#Region ### START Koda GUI section ### Form=
Local $LSbox[6]

$Form1 = GUICreate("Form1", 656, 421, -1, -1)
$LSbox[01] = GUICtrlCreateCheckbox("123", 125, 20, 300, 17)
$LSbox[02] = GUICtrlCreateCheckbox("456", 125, 41, 310, 17)
$LSbox[03] = GUICtrlCreateCheckbox("789", 125, 62, 310, 17)
$LSbox[04] = GUICtrlCreateCheckbox("321", 125, 83, 300, 17)
$LSbox[05] = GUICtrlCreateCheckbox("258", 125, 104, 300, 17)

$LSBut01 = GUICtrlCreateButton("全 选", 500, 360, 60, 25)
$LSBut02 = GUICtrlCreateButton("应 用", 570, 360, 60, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $LSBut01
                        For $i = 1 To 5
                GUICtrlSetState($LSbox[$i],$GUI_CHECKED)
                        Next
                Case $LSBut02

        EndSwitch
WEnd
如代码

如果在未做任何选择的时候按 应用  会提示没做选择

不知道如何实现呢   麻烦老师们指点下  谢谢
发表于 2011-12-15 16:58:04 | 显示全部楼层
哥们麻烦你用标准中文行吗,实在看不懂你的意思
 楼主| 发表于 2011-12-15 17:05:04 | 显示全部楼层
回复 2# netegg


     就是现在我这个还差一个功能
  
  就是在  如果未做任何选择就按应用键的话  就提示 你并没选择任何选项  请返回选择
发表于 2011-12-15 17:06:14 | 显示全部楼层
哥们麻烦你用标准中文行吗,实在看不懂你的意思
netegg 发表于 2011-12-15 16:58



    很多人发帖“如果”“如何”不分,我都免疫了……
 楼主| 发表于 2011-12-15 17:09:53 | 显示全部楼层
回复 4# afan


         吸取版主教训  下次定当修正
发表于 2011-12-15 17:10:54 | 显示全部楼层
回复 3# 872777825

if bitand(guictrlread(), $gui_unchecked) and bitand(guictrlread(), $gui_unchecked) and _
bitand(guictrlread(), $gui_unchecked) and bitand(guictrlread(), $gui_unchecked) then
msgbox(0,0,0)
    endif
发表于 2011-12-15 17:20:32 | 显示全部楼层
#RequireAdmin
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_UseUPX=n
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Process.au3>
#Region ### START Koda GUI section ### Form=
Local $LSbox[6]

$Form1 = GUICreate("Form1", 656, 421, -1, -1)
$LSbox[01] = GUICtrlCreateCheckbox("123", 125, 20, 300, 17)
$LSbox[02] = GUICtrlCreateCheckbox("456", 125, 41, 310, 17)
$LSbox[03] = GUICtrlCreateCheckbox("789", 125, 62, 310, 17)
$LSbox[04] = GUICtrlCreateCheckbox("321", 125, 83, 300, 17)
$LSbox[05] = GUICtrlCreateCheckbox("258", 125, 104, 300, 17)

$LSBut01 = GUICtrlCreateButton("全 选", 500, 360, 60, 25)
$LSBut02 = GUICtrlCreateButton("应 用", 570, 360, 60, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $LSBut01
                        For $i = 1 To 5
                                GUICtrlSetState($LSbox[$i], $GUI_CHECKED)
                        Next
                Case $LSBut02
                        If Not _CK() Then ContinueLoop MsgBox(48, '问题', '未做任何选择')
                        MsgBox(64, 'Ok', '执行')
        EndSwitch
WEnd

Func _CK()
        For $i = 1 To 5
                If GUICtrlRead($LSbox[$i]) = 1 Then Return 1
        Next
        Return 0
EndFunc   ;==>_CK
 楼主| 发表于 2011-12-15 17:42:17 | 显示全部楼层
谢谢 netegg  长老 和 afan版主

终于解决了    谢谢楼上各位老师的指点    谢谢
发表于 2012-2-10 01:43:07 | 显示全部楼层
谢谢    学习了
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-20 04:02 , Processed in 0.084162 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表