BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Switch betweem two dfm files

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics
View previous topic :: View next topic  
Author Message
Jean Pion
Guest





PostPosted: Mon Feb 13, 2006 4:03 pm    Post subject: Switch betweem two dfm files Reply with quote



Dear readers,

For some project I need to have two apearances of the same dialog.
Currently I have a file HandleDlg.dfm which defines how the dialog looks
like.
And I have a file HandleDlg.pas which defines how the dialog behaves.

Is there a simple way that I can have an extra dfm, say FancyHandleDlg.dfm,
which shows the dialog a bit different, and switch in code which appearance
to use.

Otherwise I have to duplicate *.pas as well. Which appears a bit silly, but
will work.

Please advice, Jean.
Back to top
Peter Below (TeamB)
Guest





PostPosted: Mon Feb 13, 2006 8:03 pm    Post subject: Re: Switch betweem two dfm files Reply with quote



In article <43f09e7f (AT) newsgroups (DOT) borland.com>, Jean Pion wrote:
Quote:
For some project I need to have two apearances of the same dialog.
Currently I have a file HandleDlg.dfm which defines how the dialog looks
like.
And I have a file HandleDlg.pas which defines how the dialog behaves.

Is there a simple way that I can have an extra dfm, say FancyHandleDlg.dfm,
which shows the dialog a bit different, and switch in code which appearance
to use.

Otherwise I have to duplicate *.pas as well. Which appears a bit silly, but
will work.

The VCL (and the IDE) requires that the DFM file for a form has the same
filename as the unit it belongs to. What you can do, however, is to create a
base class for the dialog that implements the common behaviour with the common
controls (or none), then derive two new form classes from this base class,
using visual form inheritance. These two classes each have their own DFM file.


--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be
Back to top
Joe Bain
Guest





PostPosted: Mon Feb 13, 2006 8:03 pm    Post subject: Re: Switch betweem two dfm files Reply with quote



Jean Pion wrote:

Quote:
Dear readers,

For some project I need to have two apearances of the same dialog.
Currently I have a file HandleDlg.dfm which defines how the dialog
looks like. And I have a file HandleDlg.pas which defines how the
dialog behaves.

Is there a simple way that I can have an extra dfm, say
FancyHandleDlg.dfm, which shows the dialog a bit different, and
switch in code which appearance to use.

Otherwise I have to duplicate *.pas as well. Which appears a bit
silly, but will work.

Please advice, Jean.


Look at CreateNew and ReadComponentResFile in the help.




--------------
Joe Bain
www.iegsoftware.com
Back to top
Jean Pion
Guest





PostPosted: Wed Feb 15, 2006 2:03 pm    Post subject: Re: Switch betweem two dfm files - Thanks Reply with quote

Thanks Joe and Peter,
that's what I needed.

Jean

"Jean Pion" <jean_pion (AT) hotmail (DOT) com> schreef in bericht
news:43f09e7f (AT) newsgroups (DOT) borland.com...
Quote:
Dear readers,

For some project I need to have two apearances of the same dialog.
Currently I have a file HandleDlg.dfm which defines how the dialog looks
like.
And I have a file HandleDlg.pas which defines how the dialog behaves.

Is there a simple way that I can have an extra dfm, say
FancyHandleDlg.dfm,
which shows the dialog a bit different, and switch in code which
appearance to use.

Otherwise I have to duplicate *.pas as well. Which appears a bit silly,
but will work.

Please advice, Jean.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.