Re: Create Forms via Parameter
From: Arda Han (arda_at_han.com)
Date: 12/12/03
- Next message: Tor Tveitane: "Deleting a directory containing files"
- Previous message: Jens Gruschel: "Re: FileExists with "My Documents" folder"
- In reply to: Ian Kirk: "Re: Create Forms via Parameter"
- Next in thread: Peter Below (TeamB): "Re: Create Forms via Parameter"
- Reply: Peter Below (TeamB): "Re: Create Forms via Parameter"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 12 Dec 2003 10:10:35 +0200
Sorry but it isn't running? I try Andrew code but it is so not running?
Anybody help me please! Peter Below where are you?
I want write some comments for my program.
I have Form1, Form2,Form3,...Formn
My table structure :
MenuName,FormName,Note,MenuParent,MenuID
I want create dynamically menu and call assigned form from Table.
I am create menu but I cann't create Form. Ian'c code is not running? Help
me please...
"Ian Kirk" <ian@kel.removethis.co.uk>, haber iletisinde şunları
yazdı:3fd89043$1@newsgroups.borland.com...
>
> "Arda Han" <arda@han.com> wrote in message
> news:3fd88cd4@newsgroups.borland.com...
> > Hi Ian,
> >
> > I try your sended code but I have an error :
> >
> > "Operator not applicable to this operand type"
> >
> > MyType:=GetClass(MyFormName) As TComponentClass ; // This error
message
> > come from here.
>
> Ooop - my bad. Replace this line with:
>
> MyType := TComponentClass(GetClass(MyFormName)) ;
>
> I tried to "improve" the type-safely of Andrew's code with a quick
untested
> change. Clearly Andrew had a good reason for doing it the way he did in
the
> first place!
>
> HTH,
> Ian
>
> > "Ian Kirk" <ian@kel.removethis.co.uk>, haber iletisinde şunları
> > yazdı:3fd880c0@newsgroups.borland.com...
> > >
> > > Arda, here's the sort of thing you need to do:
> > >
> > > 1) At some point (before you want to create the forms) register the
form
> > > classes:
> > >
> > > registerClasses([TMyForm1,TMyForm2,TMyForm3]);
> > >
> > > you can do several at once, as above, or one at a time with
> registerClass.
> > > It doesn't matter if you register things in one place, one after the
> > other,
> > > or in various places at different times. It just needs to be done
> before
> > > your first call to GetClass!
> > >
> > > Once the registration's been done you can use:
> > >
> > > var
> > > MyType : TComponentClass;
> > > MyFormname : string;
> > > MyForm : TForm;
> > >
> > > begin
> > > MyFormname:='TMyForm1';{for example, or get it from input}
> > > MyType:= GetClass(MyFormName) As TComponentClass ;
> > >
> > > MyForm:=MyType.Create(AnOwner);
> > > MyForm.Show ;
> > > end ;
> > >
> > > (Acknowledgement - code heavily copied from a 2002 post by Andrew
> Hartley)
> > >
> > > HTH,
> > > Ian
>
>
- Next message: Tor Tveitane: "Deleting a directory containing files"
- Previous message: Jens Gruschel: "Re: FileExists with "My Documents" folder"
- In reply to: Ian Kirk: "Re: Create Forms via Parameter"
- Next in thread: Peter Below (TeamB): "Re: Create Forms via Parameter"
- Reply: Peter Below (TeamB): "Re: Create Forms via Parameter"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]