TChart's events
Hi there,
I wish to expose a couple of TChart's events via RAP.
I tried to search the archive and I came across this link:
http://www.digital-metaphors.com/tips/TeeChartSeriesEventHandler.zip
Unfortunately, it's now a dead link. Can I please ask for a copy
of the link and if I'm on the right track here ? thanks a bunch !
I wish to expose a couple of TChart's events via RAP.
I tried to search the archive and I came across this link:
http://www.digital-metaphors.com/tips/TeeChartSeriesEventHandler.zip
Unfortunately, it's now a dead link. Can I please ask for a copy
of the link and if I'm on the right track here ? thanks a bunch !
This discussion has been closed.
Comments
The link should work now. This is a very simple example showing how to
assign an Series event to a chart located in a report... in Delphi. You
would need to use a passthru function in order to use these events from RAP.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Unfortunately, I'm looking for something different.
Perhaps you can give some guidelines how to implement
the Chart's events via RAP. Particularly when I click
on a chart's series. I'd like to have a way for this event
to be captured via RAP. Thanks again !
Deck
Adding a new event to RAP is a bit more involved. I would suggest spending
some time with the existing RB code for examples of how this is to be done.
1. Event prop list
If the event is not published, then override the GetEventList method and add
it to the list. (if its published it will be added automatically).
2. Event Id
For each event, you need to have a unique event id - which is an integer
used to identify the event and route it. ReportBuilder defines constants for
the events that it uses. These are defined in ppTypes and prefixed with a
'ci'.
3. Event prop rec
Override the GetPropRec method and add a call to EventToRec. For an example
in ppVar.pas, the TraTppVariableRTTI.GetPropRec method has the following...
(Note: ciComponentCalc and ciComponentReset are event id constants defined
in ppTypes.)
{events}
if (CompareText(aPropName, 'OnCalc') = 0) then
EventToRec(aPropName, ciComponentCalc, True, aPropRec)
else if (CompareText(aPropName, 'OnReset') = 0) then
EventToRec(aPropName, ciComponentReset, True, aPropRec)
4. Event params
If the event requires parameters, then override the GetParams method. For
example in ppVar.pas, the TraTppVariableRTTI.GetParams method contains the
following
if (CompareText(aMethodName, 'OnCalc') = 0) or (CompareText(aMethodName,
'OnReset') = 0) then
begin
Result := TraParamList.Create;
Result.AddParam('Value', daVariant, nil, '', False, True);
end
5. Fire the event.
To fire a RAP event, requires that the component send an event notification
. For example, in ppVar.pas, the TppVariable.DoOnCalc method contains the
following. Note that the event id ciComponentCalc is used.
lParams := TraTppVariableRTTI.GetParams('OnCalc');
lParams.CreateValuePointer(0, lValue);
SendEventNotify(Self, ciComponentCalc, lParams);
lParams.Free;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com