[Lazarus] Does closing a form hide it or free it?
vfclists .
vfclists at gmail.com
Sun Nov 6 12:44:26 CET 2016
On 5 November 2016 at 14:06, Mattias Gaertner via Lazarus <
lazarus at lists.lazarus-ide.org> wrote:
> > if FDatabasesDialog = nil then
> > FDatabasesDialog := TDatabasesForm(Screen.FindForm(TDatabasesForm.
> ClassName));
>
> FindForm finds a form by Name, not by ClassName.
>
> Mattias
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus-ide.org
> http://lists.lazarus-ide.org/listinfo/lazarus
>
FindForm depends on the ClassName, usuing
Screen.FindForm(TDatabasesForm.Name) gave the error:
Error: Only class methods, class properties and class variables can be
referred with class references
Any way my use of the Screen.FindForm routine was wrong I had a FindForm
routine of my own and I assumed that the built in one worked similarly. I
think I switched to the built in because it handles DataModules where as
mine worked on forms.
function FindForm(formClass: string):TForm;
var
i: integer;
upFormClass: string;
begin
result := nil;
upformClass := UpperCase(formClass);
for i := 0 to Screen.FormCount-1 do
begin
if UpperCase(Screen.Forms[i].ClassName) = upFormClass then
begin
result := Screen.Forms[i];
end;
end;
end;
--
Frank Church
=======================
http://devblog.brahmancreations.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20161106/014b026d/attachment.html>
More information about the Lazarus
mailing list