[Lazarus] UTF8 string compare

And3mD and3md at gmail.com
Sun Nov 1 22:24:53 CET 2009


SteveG wrote:
> Now just to push a little harder, it would be nice if I could find how to bring 
> my form to the top (therefore visible above all others), but not necessarily 
> steal the kybd entry focus until clicked on.
>
> I believe in Windows this is accomplished with the 'StayOnTop' (or similar 
> from memory) - The form remains on top of all apps, not just my own
>
>
>   
I think the way Lazarus handles the display order of an application's 
forms needs to be looked at.
There is an open bug report here
http://bugs.freepascal.org/view.php?id=11977

Setting fsStayOnTop does not work in cases where you use a constructor like
MyForm:= TSomeForm.Create(Application);

because the form does not get added to the Application's FormList.
If it is not in the FormList it does not get drawn in the correct order.

For a work around you should use
    Application.CreateForm(TSomeForm, MyForm);
instead of
    MyForm:= TSomeForm.Create(Application);

A fix to the LCL forms.pp would be to refactor the code

    if not Assigned(FFormList) then
      FFormList := TList.Create;
    FFormList.Add(AForm);

out of  TApplication.CreateForm and put it into a separate method

this bit into TApplication.Create
      FFormList := TList.Create;

and then

procedure TApplication.AddForm(AForm: TForm);
begin
  if (FFormList.IndexOf(AForm) < 0) then
    FFormList.Add(AForm);
end;

To ensure the form gets added to the Applications FormList,  the TForm 
constructor should include

  if (AOwner is TApplication) then
    TApplication(AOwner).AddForm(Self);

I am short of time at the moment can someone look at making a patch?




More information about the Lazarus mailing list