Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - [DISCUSSION] BeforeDrawRow event
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[DISCUSSION] BeforeDrawRow event

 Post Reply Post Reply
Author
Message
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Topic: [DISCUSSION] BeforeDrawRow event
    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)
  1. MouseDown
  2. MouseUp
  3. Select previous row with arrow up (only fire event when selecting previous row at the top of course)
  4. Select next row with arrow down (only fire event when selecting next row at the bottom of course)
  5. Select row with arrow left (only fire event when selecting previous row at the top of course)
  6. Select row with arrow right (only fire event when selecting next row at the bottom of course) 
  7. TAB key
  8. CTRL + SPACE
  9. CTRL + A (only fire event if last row isn't visible yet) note: CTRL + A seems to scroll to last row)
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....
Back to Top
Baldur View Drop Down
Senior Member
Senior Member


Joined: 22 November 2006
Location: Germany
Status: Offline
Points: 244
Post Options Post Options   Thanks (0) Thanks(0)   Quote Baldur Quote  Post ReplyReply Direct Link To This Post Posted: 05 November 2009 at 10:01am
Hello,
 
every event change the focus and so the layout of cells.
Please don't change this behavior.
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 06 November 2009 at 12:55am
Originally posted by Baldur Baldur wrote:

Hello,
 
every event change the focus and so the layout of cells.
Please don't change this behavior.
 
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....
Back to Top
Baldur View Drop Down
Senior Member
Senior Member


Joined: 22 November 2006
Location: Germany
Status: Offline
Points: 244
Post Options Post Options   Thanks (0) Thanks(0)   Quote Baldur Quote  Post ReplyReply Direct Link To This Post Posted: 06 November 2009 at 11:25am
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
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 29 January 2010 at 2:57am
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....
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 30 January 2010 at 2:45pm
I've had a chance to try a couple of tests so far with 14.0.0 beta. Some notes:

  1. BeforeDrawRow only fires on MouseMove for the cell that the mouse has entered. For hot-tracking purposes, maybe it should fire for the cell that the mouse has left as well?
  2. Even though BeforeDrawRow fires on MouseMove, changes made to Item.Caption or Metrics.Text do not get updated on screen.
  3. On MouseDown/MouseUp, BeforeDrawRow fires multiple times (2-3 times??)  for every visible cell on the report. I can't imagine why this should happen, but there may be a good reason? I think it would be better to fire once for each recorditem in the previously selected rows that aren't currently selected, and then fire once for every recorditem in the newly selected rows that used to be unselected. This would cover all of the scenarios that I have imagined so far, but further exploration is needed here.
  4. Even though the BeforeDrawRow fires on MouseDown/Up, changing the Item.Caption doesn't seem to get displayed immediately (the screen update is always one step behind).

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

Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 22 March 2010 at 3:59pm
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

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.