Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Keeping form name in a table

0 views
Skip to first unread message

Rob Rietow

unread,
Jun 12, 1999, 3:00:00 AM6/12/99
to
I would like to be able to keep a form name in a menu table and 'show'
it base on the menu item selected. How do I 'convert' the string form
name to a component so I can 'formname.show'.. Thanks.

...Rob...


Jeff Overcash (TeamB)

unread,
Jun 12, 1999, 3:00:00 AM6/12/99
to
You can try calling FindComponent on the owner of the forms if they are all
owned by the Application Object. Or alternativly, you can cycle through all the
forms in the Screen global variable using the FormCount and Forms properties and
compare until you find your named form.

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
If there is somebody up there could they throw me down a line. Just a
little helping hand just a little understanding. Just some answers to the
questions that surround me now. If there's somebody up there could
they throw me down a line. (Fish)
--

Rob Rietow

unread,
Jun 12, 1999, 3:00:00 AM6/12/99
to
Thanks for the reply. The screen method won't work, as I need to find all the forms
in the application. The result of finding a component is TComponent. I don't know
how to get from there to creating the form I need. Could you give an example. This
area is not an area I am familiar with.

...Rob...

David Reed

unread,
Jun 13, 1999, 3:00:00 AM6/13/99
to
>Thanks for the reply. The screen method won't work, as I need to find all
the forms
>in the application. The result of finding a component is TComponent. I
don't know
>how to get from there to creating the form I need. Could you give an
example. This
>area is not an area I am familiar with.

This will work as long as your forms are owned by the application..

procedure ShowMyForm(FormName: string);
var
f: TForm;
begin

f := TForm(Application.FindComponent(FormName));

if f = nil then
ShowMessage('Could not find Form ' + FormName)
else
f.Show;

end;

--
David Reed
Diamond Software Group, Inc
Oasis Rep Software, Inc
www.diamondsg.com
www.oasisrep.com


Rob Rietow

unread,
Jun 13, 1999, 3:00:00 AM6/13/99
to
Thanks. That got me part way. The forms have not been autocreated. How do you
handle creating the form?

...Rob...

Rob Rietow

unread,
Jun 17, 1999, 3:00:00 AM6/17/99
to
Thanks. That got me part way. The forms have not been autocreated. How do you

handle creating the form?

David Reed wrote:

0 new messages