Board index » cppbuilder » Re: It works! But now the Edit1 and BitBtn1 are active and receive focus at design time

Re: It works! But now the Edit1 and BitBtn1 are active and receive focus at design time


2003-07-31 01:16:01 AM
cppbuilder72
hi eric - I think you need to either include the header file of the other
form, or - declare the undefined as 'extern TForm ...' . This should
resolve the references. Also be aware that you cannot reference the form
until the form actually been created. This can be a circular problem at
times. Sometimes the order of create must be changed. Does that make
sense?
- frank
"Eric" < XXXX@XXXXX.COM >wrote in message
Quote
I found that this code places the Edit1 and BitBtn1 in the component box
on
an application form:

__fastcall TDateCal::TDateCal(TComponent* Owner)
: TWinControl(Owner)
{
Height = 21;
Width = 120;

Application->CreateForm(__classid(TDatePicker), &DatePicker);
DatePicker->Edit1->Parent = this;
DatePicker->BitBtn1->Parent = this;
}

The only problem with this now is that Edit1 and BitBtn1 are active, since
the form was created. Whenever you click on the component at design time
in
the form, you give focus to either one of them. Clicking BitBtn1 does not
open the calendar, though.

Is there a way to deny them focus until runtime, or not to have the
DatePicker form or its elements active until runtime?

PS: There is also another problem, detailed in my next post, when this
program is run, having to do with a Finalize function.


 
 

Re:Re: It works! But now the Edit1 and BitBtn1 are active and receive focus at design time

"frank" < XXXX@XXXXX.COM >wrote in message
Quote
hi eric - I think you need to either include the header file of the other
form, or - declare the undefined as 'extern TForm ...' . This should
resolve the references. Also be aware that you cannot reference the form
until the form actually been created. This can be a circular problem at
times. Sometimes the order of create must be changed. Does that make
sense?
Yes, that makes sense, but I did have the header file included, and now the
Edit1 box and BitBtn1 do appear where they should. The problem now is that
they can receive focus at design time.
 

Re:Re: It works! But now the Edit1 and BitBtn1 are active and receive focus at design time

Eric wrote:
Quote
Application->CreateForm(__classid(TDatePicker), &DatePicker);
I thought that one never should use Application->CreateForm(), but
always TDatePicker *DatePicker = new TDatePicker ( this );
Quote
DatePicker->Edit1->Parent = this
DatePicker->BitBtn1->Parent = this;
It does not make sense to me to assign a Parent to Components
of the newly created DatePicker. In my opinion you should only
assign a Parent to DatePicker itself. The rest should be
handled in TDatePicker's constructor.
Eric, could you summarise wich problems you still have ?
Or is all clear now ?
As I cannot follow this thread anymore.
Hans.
 

{smallsort}