TRzStringGrid: OnDrawCell Event adapter notdefined

For some reason a customer who upgraded to our latest version is having an issue with an OnDrawCell event. They get the error: "TRzStringGrid: OnDrawCell Event adapter not defined."

I see in the manual this:
"the OnEvent handlers are not automatically defined by scripter. You must implement a
TatEventDispatcher descendant class and use DefineEventAdapter method." But I couldn't find any information on how the DefineEventAdapter methods work in the docs.

Here is how the procedure is defined:
procedure RzStringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);

I'm not sure how this worked before but doesn't now. Is this something that did work at one time and now require this explicit declaration?

I tried to piece something together from a previous post I found, but honestly I have no idea how the code works when calling Scripter.ExecuteSubroutine. Could someone take a look at it?

I included ap_types in my uses.

Defined a TatEventDispather class.

  TMyRzStringGridDispatcher = class(TatEventDispatcher)
  private
    procedure __TRzStringGridDrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);
  end;

Here's where I get confused - this probably isn't right:

procedure TMyRzStringGridDispatcher.__TRzStringGridDrawCell(Sender: TObject;
  ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);
var
  StateTempSet: TGridDrawState;
  StateTemp: variant;
  RectW: TRectWrapper;
begin
  if Assigned(Scripter) and (RoutineName > '') then
  begin
    StateTempSet := State;
    StateTemp := IntFromSet(StateTempSet, SizeOf(TGridDrawState));
    RectW := TRectWrapper.Create(Rect);
    Scripter.ExecuteSubroutine(RoutineName, [Sender, ACol, ARow, RectW, StateTemp]);
    RectW.Free;
  end;
end;

Then after calling the DefineClassByRTTI - I setup DefineEventAdapter.

  Scripter.DefineClassByRTTI(TRzStringGrid);
  DefineEventAdapter(TypeInfo(TDrawCellEvent), TMyRzStringGridDispatcher, @TMyRzStringGridDispatcher.__TRzStringGridDrawCell);

Does this look right?

Thanks,

Rhett Price
IndySoft

Yes, this does look right, that's what is needed to register the event. It has always been like that, you need to register them manually. There are some adapters being registered by the import files, but seeing the files here, TDrawCellEvent is not one of them.