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

关于输入框与文字标签同步

[复制链接]
发表于 2009-10-22 13:09:20 | 显示全部楼层 |阅读模式
本帖最后由 xlcwxl 于 2009-10-22 14:26 编辑

输入框与文字标签同步太频繁,出现闪烁
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("窗体1", 413, 305, 302, 218)
$Input1 = GUICtrlCreateInput("Input1", 120, 24, 121, 21)
$Group1 = GUICtrlCreateGroup("Group1", 144, 112, 185, 105)
$Input2 = GUICtrlCreateInput("Input2", 184, 152, 121, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label1 = GUICtrlCreateLabel("Label1", 176, 128, 36, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

EndSwitch

GUICtrlSetData($Label1,GUICtrlRead($Input1))
GUICtrlSetData($Input2,GUICtrlRead($Input1))
WEnd
答案见2楼,

注意,新版的为AdlibEnable改为AdlibRegister
AdlibRegister ( "函数" [, 时间] )
函数 要注册的 Adlib 函数名称.
时间 [可选参数] 多长时间调用一次函数(单位为毫秒). 默认(Default)为 250 毫秒.
每当 250 毫秒 (或者 时间 毫秒) 就调用指定的"函数"--通常用于检查不可预知的错误
发表于 2009-10-22 13:45:43 | 显示全部楼层
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("窗体1", 413, 305, 302, 218)
$Input1 = GUICtrlCreateInput("Input1", 120, 24, 121, 21)
$Group1 = GUICtrlCreateGroup("Group1", 144, 112, 185, 105)
$Input2 = GUICtrlCreateInput("Input2", 184, 152, 121, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label1 = GUICtrlCreateLabel("Label1", 176, 128, 36, 17)
GUISetState(@SW_SHOW)
AdlibEnable("tb",50)
#EndRegion ### END Koda GUI section ###

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

EndSwitch


WEnd

func tb()
        GUICtrlSetData($Label1,GUICtrlRead($Input1))
        GUICtrlSetData($Input2,GUICtrlRead($Input1))
EndFunc
发表于 2009-10-23 06:44:43 | 显示全部楼层
使用事件模式更好些........
发表于 2011-2-20 15:07:39 | 显示全部楼层
哈哈,这个刚好学习。。
发表于 2011-3-4 19:48:23 | 显示全部楼层
这个也刚好用到,学习了。。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-10-2 12:16 , Processed in 0.094489 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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