Board index » cppbuilder » Re: enhance my app
Simon D
![]() CBuilder Developer |
Re: enhance my app2005-02-02 06:13:30 PM cppbuilder75 "JD" < XXXX@XXXXX.COM >wrote in message Quote
QuoteThe difference being extra overhead in the // ------------- void __fastcall TForm1::EditEnter(TObject *Sender) { TEdit* p = static_cast<TEdit*>(Sender); p->Color = clYellow; p->Text = "Test"; // *???* } // ------------- void __fastcall TForm1::EditExit(TObject *Sender) { TEdit* p = static_cast<TEdit*>(Sender); p->Color = clWhite; } // ------------ It compiles and runs, and does not throw any exceptions, so what is happening on the 'test' line for the other controls? neither ListBox1->Text = "Test"; nor Button1->Text = "Text"; compiles. With the colour changes the mistake may be obvious, but in other cases it may not. Accidentally connect up a TImage's event, and you get AV's, which you need to discover while testing. When I do share event handlers, it is often with different control types, so using dynamic_cast has become a habit for me anyway (right or wrong). Simon. |