当文本框在nsis安装程序中失去焦点时,我想调用一个事件,这样我就可以在调用事件时执行一个功能。
答案 0 :(得分:1)
nsDialogs不支持此事件,您通常会使用OnChange事件来更新UI的其他部分。
如果你必须这样做,你可以使用计时器:
!include LogicLib.nsh
!include nsDialogs.nsh
Page Custom MyPageCreate
Page InstFiles
Var MyEdit
Var LastFocus
Function MyEditLostFocus
System::Call KERNEL32::GetTickCount()i.r0
SendMessage $9 ${WM_SETTEXT} 0 "STR:MyEditLostFocus, tick=$0"
FunctionEnd
Function DetectFocusTimerHack
System::Call 'USER32::GetFocus()i.r0'
${If} $0 <> $MyEdit
${AndIf} $LastFocus = $MyEdit
Push $0
Call MyEditLostFocus
Pop $0
${EndIf}
StrCpy $LastFocus $0
FunctionEnd
Function MyPageCreate
nsDialogs::Create 1018
Pop $0
${NSD_CreateText} 0 30u 100% 20u "Hello"
Pop $MyEdit
${NSD_CreateText} 0 60u 100% 20u "World"
Pop $9
${NSD_CreateTimer} DetectFocusTimerHack 333
nsDialogs::Show
FunctionEnd