找回密码
 加入
搜索
查看: 2684|回复: 4

[GUI管理] GUI内的多个按钮怎么实现做同一个动作..

  [复制链接]
发表于 2010-5-21 20:26:53 | 显示全部楼层 |阅读模式
本帖最后由 bingxinchi 于 2010-5-21 21:24 编辑

一、GUI内的多个按钮怎么实现做同一个动作

二、函数 1 =函数2 = 函数3 =函数4 =函数N 的表达式该怎么写

谢谢指教额...在线等
发表于 2010-5-21 20:31:33 | 显示全部楼层
本帖最后由 水木子 于 2010-5-21 20:44 编辑

首先建议楼主修改下提问标题,当前的标题不便于搜索。
问题二什么意思不太明白,望进一步说明。

问题一
$hGUI = GUICreate('', 200, 300)
Local $aButton[6]
For $i = 0 To 5
        $aButton[$i] = GUICtrlCreateButton("Button " & ($i + 1), 50, $i * 45 + 10, 80, 30)
Next
GUISetState()

While 1
        $iMsg = GUIGetMsg()
        Switch $iMsg
                Case - 3
                        Exit
                Case $aButton[0] To $aButton[5]
                        UDF()
        EndSwitch
WEnd

Func UDF()
        MsgBox(0, '', '')
EndFunc        
发表于 2010-5-21 20:35:48 | 显示全部楼层
多个按钮执行一个事件。
$button1=guictrlcreatebutton(......)
$button2=guictrlcreatebutton(......)
$button3=guictrlcreatebutton(......)
......
$buttonN=guictrlcreatebutton(......)
......

while 1
$nmsg=guigetmsg()
switch $nmsg
   case $GUI_EVENT_CLOSE
           exit
   case $button1
          function()
   case $button2
          function()
   case $button3
          function()
.......
   case $buttonN
          function()
endswitch
wen
函数 1 =函数2 = 函数3 =函数4 =函数N
从这句,我的理解是 ,你的所有函数都有返回值,你可以直接用
if 函数1 =函数2 and 函数2= 函数3 and 函数3 =函数4 and .... and 函数N-1 =函数N then
   ;做点什么?
endif
这样的方式来解决。
 楼主| 发表于 2010-5-21 21:22:23 | 显示全部楼层
恩...3楼大虾说的是对的

这些函数都有返回值

返回值 1或是2

我需要的就是把 所有读取出来的函数拿来统一对比  到底是1还是2

if $bxwl = $1 and = $2 and = $3 and = $4 then

endif

这样对吗?
发表于 2010-5-21 22:11:22 | 显示全部楼层
if $bxwl = $1 and  $bxwl = $2 and  $bxwl = $3 and  $bxwl = $4 then

endif
IF判断的格式是   :
if 变量/函数([参数]) 逻辑运算符(=,>,<,<>) 常量值 then
       调用函数 或者是直接执行语句
endif
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-21 02:28 , Processed in 0.074788 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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