On Thu, Jan 21, 2010 at 7:50 AM, Justin Smyth
<delph...@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;
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  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to