Board index » cppbuilder » TFrame at run time exception
Francesco
CBuilder Developer |
Francesco
CBuilder Developer |
TFrame at run time exception2003-08-11 07:08:19 PM cppbuilder21 I create a TFrame with a TCombobox inside. If combo Items is not null at runtime when i create frame i have an exception : "control xxx has no parent window". How i can set the parent property if frame brake on constructor? Thanks Francecsco. |
Remy Lebeau (TeamB)
CBuilder Developer |
2003-08-12 03:02:58 AM
Re:TFrame at run time exception
"Francesco" < XXXX@XXXXX.COM >wrote in message
QuoteIf combo Items is not null at runtime when i create frame yet. Please show your actual code. QuoteHow i can set the parent property if frame brake on constructor? |
Francesco
CBuilder Developer |
2003-08-12 09:44:18 PM
Re:TFrame at run time exception
I solve the probem by override CreateWnd function, this is the code i put on frame created :
void __fastcall TFrame1::CreateWnd(void) { if (!HasParent()) Parent = dynamic_cast<TWinControl *>(Owner); TFrame::CreateWnd(); } Thanks Francecsco. "Remy Lebeau \(TeamB\)" < XXXX@XXXXX.COM >wrote: Quote
{smallsort} |
Nicola Musatti
CBuilder Developer |
2003-08-16 01:05:22 AM
Re:TFrame at run time exception
I'm picking this up, as Francesco is on holiday.
Remy Lebeau (TeamB) wrote: Quote"Francesco" < XXXX@XXXXX.COM >wrote in message in a TPageControl. These frames have a similar structure; they all inherit from the same hyerarchy: class TTreePageFrame : public TFrame; This is stored in a first package and holds code to handle which pages are visible in the TPageControl. class TFrameWP : public TTreePageFrame; This is stored in a second package and handles common visual aspects: color, font, etc. All the descendent frames, which we are trying to instantiate at runtime, are stored in a third package. Each of these contain at least one additional frame. When this inner frame contains a TComboBox whose Items property is set at design time, we experience the problem Francesco describes. Quote>How i can set the parent property if frame brake on constructor? TMyFrame * f = new TMyFrame(owner); The application crashes before we can do f->Parent = whatever; Cheers, -- Nicola Musatti Team Thai Kingdom |