MechanicalBoy
Technical User
Hi ALL.
Ok I'd better begin from the first .
I create an array of panels using the following function:
void __fastcall TForm1::butt1Click(TObject *Sender)
{
for(int i=0 ; i < 5 ; i++)
{
array = new TPalel(this);
array->setBounds(40*i,40*i,50,30);
array->Tag = i;
array->Caption = AnsiString("New panel"
Form1->InsertControl(array);
array->Visible = true;
array->OnMouseMove = __EVENT;
}
}
// TPanel array[5]; is declared as a global
Each panel call the same (OnMouseMove) handler. __EVENT declaration I placed in Unit1.h as follows:
class TForm1 : public TForm
{
__published: // IDE-managed Components
TButton *butt1;
void __fastcall butt1Click(TObject *Sender);
private: // User declarations
void __fastcall __EVENT(TObject *Sender, TShiftState Shift,
int X, int Y);
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
In Unit1.cpp I was trying to write __EVENT definition. But i don't know how can i recognize which of panels call this handler if i have them 5. i know that each of them has uniqe Tag number and i would make use of this fact. Actually i don't even know how to obatain an access to methods and properties of object that calls handler __EVENT.
i tryid to get an address of the method (void Hide(); for example) like this:
void __fastcall TForm1::mevMouseMove(TObject *Sender, TShiftState Shift,
int X, int Y)
{
void (*pointer)(void);
pointer = Sender->MethodAddress("Hide"
...
}
I realized tha Hide returns void type and is called without parametrs ...
but without success.
Can anybody help me ?
THANKS IN ADVANCE
MechanicalBoy
Ok I'd better begin from the first .
I create an array of panels using the following function:
void __fastcall TForm1::butt1Click(TObject *Sender)
{
for(int i=0 ; i < 5 ; i++)
{
array = new TPalel(this);
array->setBounds(40*i,40*i,50,30);
array->Tag = i;
array->Caption = AnsiString("New panel"
Form1->InsertControl(array);
array->Visible = true;
array->OnMouseMove = __EVENT;
}
}
// TPanel array[5]; is declared as a global
Each panel call the same (OnMouseMove) handler. __EVENT declaration I placed in Unit1.h as follows:
class TForm1 : public TForm
{
__published: // IDE-managed Components
TButton *butt1;
void __fastcall butt1Click(TObject *Sender);
private: // User declarations
void __fastcall __EVENT(TObject *Sender, TShiftState Shift,
int X, int Y);
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
In Unit1.cpp I was trying to write __EVENT definition. But i don't know how can i recognize which of panels call this handler if i have them 5. i know that each of them has uniqe Tag number and i would make use of this fact. Actually i don't even know how to obatain an access to methods and properties of object that calls handler __EVENT.
i tryid to get an address of the method (void Hide(); for example) like this:
void __fastcall TForm1::mevMouseMove(TObject *Sender, TShiftState Shift,
int X, int Y)
{
void (*pointer)(void);
pointer = Sender->MethodAddress("Hide"
...
}
I realized tha Hide returns void type and is called without parametrs ...
but without success.
Can anybody help me ?
THANKS IN ADVANCE
MechanicalBoy