找回密码
 加入
搜索
查看: 4366|回复: 6

[GUI管理] 【已解决】求助:鼠标滑动事件导致密码输入框状态切换及倒计时按钮闪动问题,求解!

  [复制链接]
发表于 2011-6-3 10:52:58 | 显示全部楼层 |阅读模式
本帖最后由 lion.lee 于 2011-6-3 13:22 编辑

问题1:显示密码后用鼠标滑过密码框,密码自动不显示。这是为什么呢?
问题2:倒计时框在倒计时的时候会闪几下(从6开始),怎么回事?
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\users\administrator\desktop\test.kxf
$Form1_1 = GUICreate("Form1", 298, 100, 450, 339)
$Input1 = GUICtrlCreateInput("password", 88, 16, 137, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD))
$Checkbox1 = GUICtrlCreateCheckbox("显示密码", 8, 8, 73, 33)
$Button1 = GUICtrlCreateButton("运行倒计时", 8, 56, 217, 33)
$Button2 = GUICtrlCreateButton("确定", 240, 16, 49, 73)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Checkbox1
                        $Checkbox = GUICtrlRead($Checkbox1)
                        Select
                                Case $Checkbox = 4
                                        $Input1 = GUICtrlCreateInput("password", 88, 16, 137, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD))
                                Case $Checkbox = 1
                                        $Input1 = GUICtrlCreateInput("password", 88, 16, 137, 21)
                        EndSelect
                Case $Button2
                        For $i = 20 To 1 Step -1
                                $Button1 = GUICtrlCreateButton("运行倒计时" & $i, 8, 56, 217, 33)
                                Sleep(500)
                        Next
                        $Button1 = GUICtrlCreateButton("运行倒计时", 8, 56, 217, 33)
        EndSwitch
WEnd
发表于 2011-6-3 12:02:48 | 显示全部楼层
本帖最后由 骗子 于 2011-6-3 12:07 编辑

倒计时的那个 换成  ; $Button1 = GUICtrlCreateButton("运行倒计时" & $i, 8, 56, 217, 33)
                         GUICtrlSetData ( $Button1,"运行倒计时" & $i )
按钮建立一次就行了,之后的全部用 GUICtrlSetData ( $Button1,"运行倒计时" & $i ) 更改显示的文本就行了

密码的那个好像也类似,只改样式就行了,不用重建
或者删了再重建

评分

参与人数 1金钱 +10 收起 理由
tryhi + 10

查看全部评分

发表于 2011-6-3 12:13:43 | 显示全部楼层
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiEdit.au3>
#include <GuiConstantsEx.au3>
Local $k=20
#Region ### START Koda GUI section ### Form=c:\users\administrator\desktop\test.kxf
$Form1_1 = GUICreate("Form1", 298, 100, 450, 339)
$Input1 = GUICtrlCreateInput("password", 88, 16, 137, 21, $ES_PASSWORD)
$Checkbox1 = GUICtrlCreateCheckbox("显示密码", 8, 8, 73, 33)
$Button1 = GUICtrlCreateButton("运行倒计时", 8, 56, 217, 33)
$Button2 = GUICtrlCreateButton("确定", 240, 16, 49, 73)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Checkbox1
                        If GUICtrlRead($Checkbox1) = 4 Then
                                _GUICtrlEdit_SetPasswordChar($Input1, "*")
                                GUICtrlSetState($Input1, $GUI_FOCUS)
                        Else
                                _GUICtrlEdit_SetPasswordChar($Input1)
                                GUICtrlSetState($Input1, $GUI_FOCUS)
                        EndIf
                Case $Button2
                        if GUICtrlRead($Button2)="确定" Then
                                AdlibRegister("time",1000)
                                GUICtrlSetData($Button2,"取消")
                                time()
                        Else
                                AdlibUnRegister("time")
                                GUICtrlSetData($Button1,"运行倒计时")
                                GUICtrlSetData($Button2,"确定")
                                $k=20
                        EndIf
        EndSwitch
WEnd

func time()
        if $k<1 Then 
                AdlibUnRegister("time")
                Exit
        EndIf
        GUICtrlSetData($Button1,"运行倒计时"&$k)
        $k-=1
EndFunc

评分

参与人数 1金钱 +10 收起 理由
tryhi + 10

查看全部评分

 楼主| 发表于 2011-6-3 13:05:26 | 显示全部楼层
感谢3mile兄得指点,问题已解决。谢谢啊!
发表于 2011-6-3 13:16:38 | 显示全部楼层
回复 4# lion.lee
若已经解决请编辑标题为[已解决]
 楼主| 发表于 2011-6-3 13:22:08 | 显示全部楼层
本帖最后由 lion.lee 于 2011-6-3 13:24 编辑

回复 2# 骗子
谢谢“骗子”兄弟,你的方法也可行。多谢啦!
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\users\administrator\desktop\test.kxf
$Form1_1 = GUICreate("Form1", 298, 100, 450, 339)
$Input1 = GUICtrlCreateInput("********", 88, 16, 137, 21)
$Checkbox1 = GUICtrlCreateCheckbox("显示密码", 8, 8, 73, 33)
$Button1 = GUICtrlCreateButton("运行倒计时", 8, 56, 217, 33)
$Button2 = GUICtrlCreateButton("确定", 240, 16, 49, 73)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Checkbox1
                        $Checkbox = GUICtrlRead($Checkbox1)
                        Select
                                Case $Checkbox = 1
                                        GUICtrlSetData($Input1, "password")
                                Case $Checkbox = 4
                                        GUICtrlSetData($Input1, "********")
                        EndSelect
                Case $Button2
                        $i = 20
                        $Button1 = GUICtrlCreateButton("运行倒计时" & $i, 8, 56, 217, 33)
                        For $i = 20 To 1 Step -1
                                GUICtrlSetData($Button1, "运行倒计时" & $i)
                                Sleep(500)
                        Next
                        GUICtrlSetData($Button1, "运行倒计时")
        EndSwitch
WEnd

评分

参与人数 1金钱 +10 收起 理由
tryhi + 10

查看全部评分

发表于 2011-6-5 11:31:07 | 显示全部楼层
方法都不错~^%
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-21 06:21 , Processed in 0.081709 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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