On 13-11-15 11:13 PM, K. P. wrote:
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: [email protected]
> To: [email protected]
> 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;
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus