EditFoucs não funcina?

Tire suas dúvidas sobre programação em AutoHotkey

Moderator: Gio

AutoHotkeyHelpMe
Posts: 1
Joined: 18 Sep 2020, 18:49

EditFoucs não funcina?

20 Nov 2023, 20:06

Estou tendo problemas com esse pedaço de script, o EditFocus não esvazia a caixa Edit

Code: Select all

EditFocus:
    GuiControlGet, palavraChave
    if (palavraChave = "Digite a palavra-chave")
    {
        GuiControl, , palavraChave, ""
        GuiControl, Font, cBlack
    }
return

EditFocusLost:
    GuiControlGet, palavraChave
    if (palavraChave = "")
    {
        GuiControl, , palavraChave, Digite a palavra-chave
        GuiControl, Font, cGray
    }
return
[Mod edit: Changed codebox type from text to AuotHotkey.]
Last edited by gregster on 20 Nov 2023, 20:21, edited 1 time in total.
Reason: Moved topic from 'Ask from Help (v2)', due to used language - please use English in the main forums! Also, this is not v2 code.
garry
Posts: 3771
Joined: 22 Dec 2013, 12:50

Re: EditFoucs não funcina?

21 Nov 2023, 10:49

;- exemplo > login + password > ENTER

Code: Select all

;- exemplo > login + password > ENTER
#Warn
#NoEnv
setworkingdir,%a_scriptdir%
Filename1=Login_Password_ENTER
Gui,2: Color,Black,Black       
Gui,2:show,x0 y0 w400 h70,%filename1%
Gui,2:Font,cYellow S14 ,Lucida Console
Gui,2:add,edit  ,x10  y5   h35  w120 vED1 hwndHED11 left -vscroll,
Gui,2:add,edit  ,x140 y5   h35  w120 vED2 hwndHED12 left +Password -vscroll,  ;- 123456
Gui,2:add,button,x0 y0  h0  w0 gA1 default,ENTER
SetEditCueBanner(HED11, "Username")
SetEditCueBanner(HED12, "Password")
GuiControl,2: Focus,ED1
return
;----------------------
2Guiclose:
exitapp
;----------------------
A1:
Gui,2:submit,nohide
if ED2=123456
   gosub,A2
else
   msgbox, 262160,PASSWORD ,senha incorreta
return
;--------------
A2:
try,run,https://news.google.com/home?hl=pt-PT&gl=PT&ceid=PT:pt-150
exitapp
;--------------
SetEditCueBanner(HWND, Cue) {  ; requires AHL_L
   Static EM_SETCUEBANNER := (0x1500 + 1)
   Return DllCall("User32.dll\SendMessageW", "Ptr", HWND, "Uint", EM_SETCUEBANNER, "Ptr", True, "WStr", Cue)
}
;=====================
exemplo-2

Code: Select all

 
#NoEnv
setworkingdir,%a_scriptdir%
Filename1=TEST
Gui,2: Color,Black,Black       
aa:=" Digite a palavra-chave  "
Gui,2:show,x0 y0 w570 h110,%filename1%
Gui,2:Font,cYellow S14 ,Lucida Console
Gui,2:add,edit  ,x10 y5   h35  w540 vED1 left readonly,%aa%
Gui,2:add,button,x10 y65  h35  w100 gA1,CHANGE
return
;----------------------
2Guiclose:
exitapp
;----------------------
A1:
Gui,2:submit,nohide
if ed1=%aa%
   GuiControl,2:,ED1,
if ed1=
   GuiControl,2:,ED1,%aa%
return
;============================

Return to “Ajuda e Suporte Geral”

Who is online

Users browsing this forum: No registered users and 49 guests