Article

From:
To:
Adalberto Baldini
Subject:
Re: SetFocus not working well
Newsgroup:
embarcadero.public.delphi.language.delphi.win32

Re: SetFocus not working well

Adalberto Baldini wrote:

> Do you mean if I see another object focused?

Yes.

> I dont see the cursor anywhere.

Mh, the focus may be on a panel or such, which does not show any
indication of it. Or no control may have the focus, which is highly
unusual.

> There is a way to see which component is focused ? maybe displaying
> it name in a label ?

Best try this from a timer event:

{code: Delphi} var    LControl : TWinControl;
 if Screen.Activecontrol <> nil then     label1.caption := Screen.ActiveControl.Name  else    if Windows.GetFocus <> 0 then begin      LControl := FindControl(Windows.GetFocus);      if Assigned(LControl) then        label1.caption := LControl.Name      else         label1.caption := 'No VCL control with focus'    end    else      label1.caption := 'No focus anywhere';
{code}


-- Peter Below (TeamB) Don't be a vampire (http://slash7.com/pages/vampires), use the newsgroup archives : http://codenewsfast.com http://groups.google.com
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Sun, 30 Jun 2024 18:02:49 UTC
Copyright © 2009-2024
HREF Tools Corp.