找回密码
 加入
搜索
楼主: blue_dvd

[GUI管理] GUI中OnEvent模式出现问题?【已解决】

  [复制链接]
发表于 2016-12-12 15:14:25 | 显示全部楼层
嘿,怎么没想到用数组
 楼主| 发表于 2016-12-12 23:15:28 | 显示全部楼层
回复 16# chzj589
local $Button[6]
$Button[0] = GUICtrlCreateButton("模块1", 10, 464, 80, 41)

$Button[1] = GUICtrlCreateButton("模块2", 110, 464, 80, 41)

$Button[2] = GUICtrlCreateButton("模块3", 210, 464, 80, 41)

$Button[3] = GUICtrlCreateButton("模块4", 310, 464, 80, 41)

$Button[4] = GUICtrlCreateButton("模块5", 410, 464, 80, 41)

$Button[5] = GUICtrlCreateButton("模块6", 510, 464, 80, 41)
数组是这样搞吗?挺麻烦的
发表于 2016-12-13 08:09:54 | 显示全部楼层
回复 17# blue_dvd
是的。
那就用直接的
GUICtrlSetOnEvent($Button2, "_Every_month_Record")
 楼主| 发表于 2016-12-13 11:34:51 | 显示全部楼层
本帖最后由 blue_dvd 于 2016-12-13 11:45 编辑

回复 18# chzj589
直接用
GUICtrlSetOnEvent(按钮, "函数名")
但是按钮多的话是不是
For $i=1 to  6
 GUICtrlSetOnEvent(Eval("Button"&String($i)), "_Main")
Next
会更好?
发表于 2016-12-13 12:18:01 | 显示全部楼层
回复  chzj589
直接用但是按钮多的话是不是会更好?
blue_dvd 发表于 2016-12-13 11:34

按钮多可以用数组

Global $Button[7]
        $Form1_1 = GUICreate("测试系统", 800, 600, -1, -1)
        $Button[1] = GUICtrlCreateButton("模块1", 10, 464, 80, 41)
        $Button[2] = GUICtrlCreateButton("模块2", 110, 464, 80, 41)
        $Button[3] = GUICtrlCreateButton("模块3", 210, 464, 80, 41)
        $Button[4] = GUICtrlCreateButton("模块4", 310, 464, 80, 41)
        $Button[5] = GUICtrlCreateButton("模块5", 410, 464, 80, 41)
        $Button[6] = GUICtrlCreateButton("模块6", 510, 464, 80, 41)
        GUISetState(@SW_SHOW)
        For $i = 1 To 6
                GUICtrlSetOnEvent($Button[$i], "_Main")

        Next
 楼主| 发表于 2016-12-14 11:11:47 | 显示全部楼层
回复 20# chzj589
这个知道,多谢了!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-18 21:13 , Processed in 0.069153 second(s), 14 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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