ActiveFormHandle from TApplication

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ActiveFormHandle from TApplication

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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: ActiveFormHandle from TApplication

Anthony Walter-3
On Thu, Jan 21, 2010 at 7:50 AM, Justin Smyth <[hidden email]> 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;
var
  C: TControl;
begin
  C := FindControl(GetFocus);
  if (C <> nil) and (C.Parent <> nil) then
    Result := GetParentForm(C)
  else
    Result := nil;
end;

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: ActiveFormHandle from TApplication

Paul Ishenin-2
In reply to this post by Justin Smyth
21.01.2010 19:50, Justin Smyth 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 ).
You are searching the wrong object. Look at TScreen.ActiveForm / TScreen.ActiveCustomForm (as I remember).

Best regards,
Paul Ishenin.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal