[fpc-pascal] ActiveFormHandle from TApplication

Anthony Walter sysrpl at gmail.com
Thu Jan 21 14:19:14 CET 2010

On Thu, Jan 21, 2010 at 7:50 AM, Justin Smyth
<delphian at smythconsulting.net>wrote:

>  Any one know how to get the Active Handle from the current Form from
> TApplication ? Delphi has something for this but i cant see it.
> I'm in the progress of getting JVCL working under FPC / lazarus ( FPC 2.5.1
> & Lazarus Win64 V 0.9.29 )
> I suspect i might need to make a property to read the TList of FFormList
> and check on each form to out if its the active form. ( not sure about this
> part ).

Here is a function for you:

function FindActiveForm: TCustomForm;
  C: TControl;
  C := FindControl(GetFocus);
  if (C <> nil) and (C.Parent <> nil) then
    Result := GetParentForm(C)
    Result := nil;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20100121/16dfc6ab/attachment.html>

More information about the fpc-pascal mailing list