Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi - Capturing the Window/Form which has current focus

Tags:

delphi

vcl

tform

I have an MDI application with numerous MDI Children (and also non MDI forms) and would like to track which form is currently activate and has the focus at all times. When a user switches from one form to another within the application I would like to trap the window activation message and in the background set a global variable to a property of the form which is active (this property is inherited from a base class). I originally put code in the OnActivate event handler for the base class (which all the forms in my application use) but have noticed that this event does not always get raised. Any ideas?

I am using Delphi 2006 BDS.

like image 919
PDM Avatar asked Mar 11 '26 05:03

PDM


1 Answers

Is the ActiveMDIChild property what you are looking for?

like image 90
Birger Avatar answered Mar 12 '26 19:03

Birger