Solved

Catch Focus of Edit

Posted on 1998-11-09
2
145 Views
Last Modified: 2010-04-04
Is is possible receive some Notification when an EditBox is activated at run-time, either thru a Mouse Click of it or using the Tab Key ?
0
Comment
Question by:omsec
2 Comments
 
LVL 1

Accepted Solution

by:
zac earned 10 total points
ID: 1346253
You can use the OnEnter event to capture the activation and onExit as focus is lost from the control.  However the OnEnter event does not occur when switching between forms or between another Windows application and the application that includes the windowed control.

I hope this helps

Zac
0
 
LVL 1

Expert Comment

by:rpetruni
ID: 1346254
I use this one for coloring active control:

procedure TForm1.FormCreate(Sender: TObject);
begin
     Screen.OnActiveControlChange:=ColorControl;
end;

procedure TForm1.ColorControl(Sender: TObject);
var
  I : Integer;
  Forma: Tform1;
begin
  for I:= 0 to Forma.ControlCount -1 do
   begin
    if (Forma.Controls[I] is TWinControl) then
    begin
      if (Forma.Controls[I] as TWinControl).Focused then
      TEdit(Forma.Components[I])as TWinControl).color:=clWindow
      else
      TEdit(Forma.Components[I]).color:=clBtnFace;
    end;
   end;
end;

Any control wich is focused is colored in clWindow...
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
LAN or WAN ? 11 95
Drag & Drop... Data from one grid to another 2 41
Firemonkey allowing RTL on android 6 46
Delphi problems to abort a printjob 9 24
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question