Google has failed me on this one. :( I need to check to see if a dynamically created form (object) with a given title already exists within the application, and if so, to raise it to the front.
Mailing lists / lazarus / 2013-11
Find Form instance with Title
3 messages · 2 people ·
- TTimothy Groves 2
- KK. P. 1
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Look at your Screen object:
http://lazarus-ccr.sourceforge.net/docs/lcl/forms/tscreen.html
Check out FindForm and Forms
Show quoted text 14 lines
Date: Fri, 15 Nov 2013 22:32:37 -0500
From:
To:
Subject: [Lazarus] Find Form instance with Title
Google has failed me on this one. :( I need to check to see if a
dynamically created form (object) with a given title already exists
within the application, and if so, to raise it to the front.
--
_______________________________________________
Lazarus mailing list
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131116/992753b3/attachment.html>
K. P. wrote 16 lines
Look at your Screen object:
http://lazarus-ccr.sourceforge.net/docs/lcl/forms/tscreen.html
Check out FindForm and Forms
> Date: Fri, 15 Nov 2013 22:32:37 -0500
> From:
> To:
> Subject: [Lazarus] Find Form instance with Title
>
> Google has failed me on this one. :( I need to check to see if a
> dynamically created form (object) with a given title already exists
> within the application, and if so, to raise it to the front.
Thanks for the steer! In case anyone cares, here's how I implemented this:
procedure TfrmVolume.lstVolumesDblClick (Sender : TObject );
var
NewStoryForm : TfrmStory;
FormCaption : string;
index : integer;
Present : boolean;
begin
FormCaption := 'Volume "' + Volumes.Current.VolumeName + '"'; //
The caption I want to search for/create.
index := 0;
Present := false;
repeat
if (Screen.Forms [index].Caption = FormCaption) then
Present := true
else
index += 1;
until (Present or (index >= Screen.FormCount));
if (Present) then
Screen.Forms [index].BringToFront
else begin
NewStoryForm := TfrmStory.Create (Application);
NewStoryForm.Caption := FormCaption;
NewStoryForm.Show;
end;
end;-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131115/eec53184/attachment.html>
