How to force the balloon "Caps Lock is On" for password editor?

I have a TEdit with PasswordChar set to * , and I want the standard "Caps Lock is On" checkbox to appear if Caps Lock . This standard balloon appears only when the editor receives focus or when the Caps Lock mode is on while the focus was in this editor.

My password editor is the first focused control of the application. So, when the application starts with the previously set Caps Lock mode, I don't see any balloons until my password editor loses focus and then focuses again. The user has the opportunity not to see this balloon in half the use cases!

Can I make this β€œCaps Lock is On” checkbox when starting the application without switching focus?

+4
source share
1 answer

The solution is to call WM_KILLFOCUS and WM_SETFOCUS , this will force the editor to display a "Caps Lock is On" balloon:

  if GetKeyState(VK_CAPITAL) and 1 <> 0 then begin if edtPassword.Focused then begin PostMessage(edtPassword.Handle, WM_KILLFOCUS, 0, 0); PostMessage(edtPassword.Handle, WM_SETFOCUS, 0, 0); end; end; 
+4
source

Source: https://habr.com/ru/post/1447006/


All Articles