OnDrawCommandClick
Hi Folks,
A couple of question about OnDrawCommandClick:
#1: I've seen the RB example of the OnDrawCommandClick using Delphi --
causing the background colour of a shape to change when clicked on. I tried
the same code in RAP, and while it executes, the colour of the shape doesn't
change.
#2: I can't seem to get RAP to understand what record it is on during the
click? I.e. tried ShowMessage( ReportDataSource['FIELDNAME'] ),
ShowMessage( Variable.Value ), ShowMessage( Label1.Caption ), etc. However,
it always displays the value of the first record.
Thanks,
Brett
A couple of question about OnDrawCommandClick:
#1: I've seen the RB example of the OnDrawCommandClick using Delphi --
causing the background colour of a shape to change when clicked on. I tried
the same code in RAP, and while it executes, the colour of the shape doesn't
change.
#2: I can't seem to get RAP to understand what record it is on during the
click? I.e. tried ShowMessage( ReportDataSource['FIELDNAME'] ),
ShowMessage( Variable.Value ), ShowMessage( Label1.Caption ), etc. However,
it always displays the value of the first record.
Thanks,
Brett
This discussion has been closed.
Comments
1. I researched this. The event is firing correctly. However there is
problem with setting the DrawCommand.RedrawPage property - it compiles but
does not execute correctly. The RAP RTTI DrawCommand class is descending
from an incorrect RTTI ancestor class. Here is a unit that you can download.
It contains a replacement class. You will need to add this unit to the
'uses' clause of your report form. This unit will unregister the existing
TraDrawCommandRTTI class and register a new one called TmyDrawCommandRTTI.
www.digital-metaphors.com/tips/myDrawCommandRTT.zip
For ReportBuilder 7, the TppDrawCommand class was modified to descend from
TppRelative. The DrawCommandRTTI class needs to be modified to descend from
the RelativeRTTI class. We cannot make patch the current release because it
would require modifying the interface section of a unit.
2. The architecture for TppPage.DrawCommands[] is decoupled from the data
traversal. The TppPage objects are stand alone entities that in fact can
exist in a report cache (i.e. if you set Report.CachePages to true) or can
be streamed to an archive file (.raf) and then later read and displayed by
the ArchiveReader component.
It is possible to use the OnDrawCommandCreate event to attach information to
the DrawCommand.Tag property. The timing of OnDrawCommandCreate is in sync
with the data traversal. Here is an example that uses RAP and
OnDrawCommandCreate:
www.digital-metaphors.com/tips/DrawCommandClickAndDisplayData.zip
--
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
This link does not seem valid. Can you please verify the link?
Thanks,
Brett
Sorry about that, the link should work correctly now.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Ugh! I've been struggling with this all day. An old co-worker had it
functioning in a few reports, but it won't work for me, even after editing
his old reports. Seems you finally identified the problem, so maybe we'll
see a fix for it in RB8. Until then, I guess I can't use on-screen
controls.
-Nathan Seeley
The download file that we provided fixes this issue completely.
--
Nard Moseley
Digital Metaphors Corporation
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com