Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-01

ActiveFormHandle from TApplication

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Justin Smyth

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 ).

Reply by email

Anthony Walter
to Justin Smyth
Justin Smyth wrote 10 lines
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;
var
  C: TControl;
begin
  C := FindControl(GetFocus);
  if (C  nil) and (C.Parent  nil) then
    Result := GetParentForm(C)
  else
    Result := nil;
end;

Reply by email

Paul Ishenin
to Justin Smyth: Any one know how to get the Active Handle from the current Form from TApplication ?…
Justin Smyth wrote 7 lines
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 ).

You are searching the wrong object. /
TScreen.ActiveCustomForm (as I remember).

Best regards,
Paul Ishenin.

Reply by email