Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Addressing event at run time

0 views
Skip to first unread message

Giovanni Benintende

unread,
Dec 31, 2008, 3:04:20 AM12/31/08
to
Hello,

In CPPB 6 I made a custom control class named TMyDBGrid derived from TDBGrid.

Then I declared a new event handler declaration:

class TMyDBGrid;

typedef void __fastcall (__closure *TCustomizeMyDBGrid)(System::TObject* Sender, TMyDBGrid * Grid);

class PACKAGE TMyDBGrid : public TDBGrid
{
...
__published:
_property TCustomizeMyDBGrid OnCustomizeGrid = {read=FOnCustomizeGrid, write=FOnCustomizeGrid};
};

It works fine so that I can use it normally in my projects.

Now I need to assign possible different events at run-time, into end-user projects:

class TFormBase : public TForm
{
...
__published: // IDE-managed Components
void __fastcall CustomizeGrid1(TObject *Sender, TMyDBGrid *Grid);
void __fastcall CustomizeGrid2(TObject *Sender, TMyDBGrid *Grid);
etc...
}

But am not able to proceed when I try to do this:

MyDBGrid->OnCustomizeGrid = CustomizeGrid1;

or:

MyDBGrid->OnCustomizeGrid = (TCustomizeMyDBGrid) CustomizeGrid1;


After many attempts with different casting and/or addressing options, I concluded that I am still.

Any suggestion?

Regards,
Giovanni Benintende

0 new messages