[DISCUSSION] BeforeDrawRow event |
Post Reply |
Author | |
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
Posted: 17 October 2009 at 6:57am |
Hi
This post is about when to fire BeforeDrawRow event and when not. In my opinion (and maybe others as well) the BeforeDrawRow event is overdoing it's job. There are cases when no event is required because nothing has to be redrawn (in my opinion) but maybe there are members who need the event anyway. Here's a list of cases in which I don't think the event has to be fired.
Note: Mark asked me to produce this list because of some problems we encountered in Jason's Markup Demo (https://forum.codejock.com/forum_posts.asp?TID=14983)
Please, if you can think of other cases, don't hesitate to reply.
Thanks a lot
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
Baldur
Senior Member Joined: 22 November 2006 Location: Germany Status: Offline Points: 244 |
Post Options
Thanks(0)
|
Hello,
every event change the focus and so the layout of cells.
Please don't change this behavior.
|
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi Baldur,
I'm glad someone joined the discussion
My question to you: why should fire BeforeDrawRow event on a mouseclick (or any of the other cases in my list) The RC looks exactly the same as before I clicked in RC area. So in these cases I don't want that event to fore. Just for fun, add some counter in BeforeDrawRow event in Jason Demo with Markup widgets and see how many times the BeforeDrawRow fires. It's consumes a lot of (sometimes) processor time and in some cases "forgets" the (like in Jason's Demo) mouseclick.
Just give me a reason why the event should still fire not just: "every event change the focus and so the layout of cells.
Please don't change this behavior"
Thank you for reply and I hope many others will join in this discussion
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
Baldur
Senior Member Joined: 22 November 2006 Location: Germany Status: Offline Points: 244 |
Post Options
Thanks(0)
|
Hi Aaron,
i have tested this "counter" long time ago, maybe with Version 9 and found also that the event somtimes is send oftener as needed.
But the main problem in this case is windows and "InvalidateRect" to reduce this events.
I think, that the Report don't store the Metrics-Property in the Cells-Properties so in case of repaint, he must ask for.
On the other hand, you can decide by yourself with SetCustomDraw at runtime when events should occur or not.
So you can decide in case of FocusChanging to turn the xtpCustomBeforeDrawRow on or off to reduce the events.
But in case of scrolling, sorting, grouping, the events are gone (no FocusChanging).
On the other hand, most properties of metrics can be set for each individual items so perhaps you don't need this event.
What i found is, that this event is fired for each column in the grid.
It can be automaticly reduced to only the visible columns !
Regards
Baldur
|
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi,
It seems that I'm the only in here who has an opinion (except for Baldur of course) so I will leave it as is and will create my own "Update event" at least for Markup.
Thank you
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
jpbro
Senior Member Joined: 12 January 2007 Status: Offline Points: 1355 |
Post Options
Thanks(0)
|
I've had a chance to try a couple of tests so far with 14.0.0 beta. Some notes:
The fact that updates to the RC after changing the Item.Caption in BeforeDrawRow always seems to be behind makes me think that I am missing something (Redraw method doesn't work since it cause BeforeDrawRow to fire continuously, UpdateRecord killed the IDE for me - so what is the right way to get an immediate ReportItem update on-screen after changing the Item.Caption in the BeforeDrawRow event?). Maybe what we need is a BeforeDrawRowFlags property with flags to control when BeforeDrawRow is fired based on our needs? Something like: xtpBeforeDrawRowMouseEnter - Fire when mouse enters a RecordItem. Only fire once for that recorditem. xtpBeforeDrawRowMouseLeave - Fire when mouse leaves a RecordItem. Only fire once fo that recorditem. xtpBeforeDrawRowMouseMove - Fire when mouse is moved within a RecordItem. Only fire for that recorditem. xtpBeforeDrawRowMouseDown - Fire when mouse button is depressed while over a RecordItem. only fire once for that recorditem xtpBeforeDrawRowMouseUp - Fire when mouse is released while over a RecordItem. Only fire once for that recorditem. xtpBeforeDrawRowSelected - Fire when a RecordItem parent Record becomes selected. Only fire once for that recorditem. xtpBeforeDrawRowDeselected - Fire when a RecordItem parent Record becomes deselected. Only fire once for that recorditem. Flags could of course be combined to fire under multiple circumstances. It would be nice if the BeforeDrawRow event would also pass the flag that caused the firing as a parameter (of course, for Binary compatibility, this would mean we would need a different event, perhaps BeforeDrawRowEx). These flags would cover all of the cases I have thought of so far where you would want BeforeDrawRow to fire, but there may be other times - any ideas on extensions for this list? Here's the test project I was using: uploads/20100130_145004_RcBeforeDrawRow.zip |
|
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|
jpbro
Senior Member Joined: 12 January 2007 Status: Offline Points: 1355 |
Post Options
Thanks(0)
|
Comments from Codejock on the BeforeDrawRowEx idea would be very appreciated!
|
|
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |