"radoica", molim te da sledeći put otvoriš dve nove teme za dva nova pitanja.
Mislim da je u ovom slucaju takoyvani subclassing najbolje resenje.
NETESTIRANO:
--- H ---
Code:
class TNoviButton : public TButton
{
protected:
void __fastcall WndProc( TMessage &Message );
public:
__fastcall TNoviButton(TComponent *Owner) : TButton(Owner) {};
};
class TForm1 : public TForm
{
__published: // IDE-managed Components
TButton *Button1;
private: // User declarations
public: // User declarations
TNoviButton *pNoviButton;
TNoviButton *pNoviButton2;
__fastcall TForm1(TComponent* Owner);
__fastcall ~TForm1();
};
--- CPP ---
Code:
void __fastcall TNoviButton::WndProc( Messages::TMessage &Message )
{
if ( Message.Msg == WM_SETFOCUS )
{
SendMessage( /*Form1->pNoviButton->*/Handle, WM_KILLFOCUS, Message.Msg, NULL );
}
else
{
TButton::WndProc( Message );
}
}
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
pNoviButton = new TNoviButton( this );
pNoviButton->Parent = this;
pNoviButton->Caption = "Novi Taster";
pNoviButton2 = new TNoviButton( this );
pNoviButton2->Parent = this;
pNoviButton2->Caption = "Novi Taster2";
pNoviButton2->Left = 300;
}
__fastcall TForm1::~TForm1()
{
delete pNoviButton;
delete pNoviButton2;
}
Malo sam izmenio kod da mozes da napravis familiju TNoviButton-a, a da svi imaju ubijen fokus.
[Ovu poruku je menjao X Files dana 18.09.2006. u 23:16 GMT+1]