Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

[BUG?] CellBackgroundPaint not overriding default highlighting? (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: Re: Where to place a 'very final' code for a window? (Correction)
Next thread: Where to place a 'very final' code for a window?


Win32 API Declares   -   Berg, Heath
  [BUG?] CellBackgroundPaint not overriding default highlighting?   -   Paul Howson
   Re: [BUG?] CellBackgroundPaint not overriding default highlighting?   -   Dennis Birch
   Re: [BUG?] CellBackgroundPaint not overriding default highlighting?   -   Paul Howson
   Re: [BUG?] CellBackgroundPaint not overriding default highlighting?   -   tjmac tolisgroup.com
   Re: [BUG?] CellBackgroundPaint not overriding default highlighting?   -   Paul Howson

[BUG?] CellBackgroundPaint not overriding default highlighting?
Date: 19.08.05 20:11 (Sat, 20 Aug 2005 05:11:37 +1000)
From: Paul Howson
Try this:

- New project. One listbox in a window. Add a few rows of data.
- In the CellBackgroundPaint for the listbox, put "return true".
- Run the project.

When clicking on a row it still highlights in the blue highlight color.

In the language reference for listbox.CellBackgroundPaint it says:

"True means the user has handled the background paint and no other
processing is to be done with the background. In this case the user
is responsible for all highlighting."

My reading of this is that RB should NOT draw the blue highlighting
if the user's CellBackgroundPaint event returns true.

Is this a bug, or are the docs incorrect?

Paul Howson.

----------------------------------------------------------------
The Design Group Qld, Warwick Qld Australia
web: www.tdgq.com.au email: <email address removed>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: [BUG?] CellBackgroundPaint not overriding default highlighting?
Date: 20.08.05 01:24 (Fri, 19 Aug 2005 17:24:25 -0700)
From: Dennis Birch
>Try this:
>
>- New project. One listbox in a window. Add a few rows of data.
>- In the CellBackgroundPaint for the listbox, put "return true".
>- Run the project.
>
>When clicking on a row it still highlights in the blue highlight color.
>
>In the language reference for listbox.CellBackgroundPaint it says:
>
>"True means the user has handled the background paint and no other
>processing is to be done with the background. In this case the user
>is responsible for all highlighting."
>
>My reading of this is that RB should NOT draw the blue highlighting
>if the user's CellBackgroundPaint event returns true.
>
>Is this a bug, or are the docs incorrect?

I was really concerned when I read your message because I use custom
list highlighting in one of my applications, which is built with
5.5.5. I'd like to be able to migrate it to 2005 someday. So I did a
quick test in 5.5.5, which happens to be running on my machine right
now.

if me.ListIndex = row Then
g.ForeColor = &cFF0000
g.FillRect 0, 0, g.Width, g.Height
end
Return True

Works as you would expect. When I click on a row, the row turns red,
not the blue my system highlight color is set for.

When I comment out everything in the if...endif block so that Return
True is the only code that's executed, I get the behavior you
describe. I don't know how the code above works in 2005, but I wonder
if it suggests a workaround.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: [BUG?] CellBackgroundPaint not overriding default highlighting?
Date: 20.08.05 06:25 (Sat, 20 Aug 2005 15:25:42 +1000)
From: Paul Howson
On 20/08/2005, at 10:24 AM, Dennis Birch wrote:

> I was really concerned when I read your message because I use
> custom list highlighting in one of my applications, which is built
> with 5.5.5. I'd like to be able to migrate it to 2005 someday. So I
> did a quick test in 5.5.5, which happens to be running on my
> machine right now.
>
> if me.ListIndex = row Then
> g.ForeColor = &cFF0000
> g.FillRect 0, 0, g.Width, g.Height
> end
> Return True
>
> Works as you would expect. When I click on a row, the row turns
> red, not the blue my system highlight color is set for.
>
> When I comment out everything in the if...endif block so that
> Return True is the only code that's executed, I get the behavior
> you describe. I don't know how the code above works in 2005, but I
> wonder if it suggests a workaround.

The background painting by RealBasic that I describe happens BEFORE
the call to CellBackgroundPaint. Indeed one can over-paint that in
CellBackgroundPaint. What returning true from CellBackgroundPaint
does in this case is inhibit RealBasic painting the background AGAIN
afterwards. Returning false from CellBackgroundPaint causes RealBasic
to paint the selection colour AGAIN, obliterating any painting done
by the user in CellBackgroundPaint.

So what I'm observing is the RealBasic is painting the highlight blue
BEFORE the call to CellBackgroundPaint, which according to the docs
it should not do. It's not a showstopper, because as you point out,
one can just paint over it. But I don't think that happened in RB5.5.

Paul Howson

----------------------------------------------------------------
The Design Group Qld, Warwick Qld Australia
web: www.tdgq.com.au email: <email address removed>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: [BUG?] CellBackgroundPaint not overriding default highlighting?
Date: 22.08.05 01:08 (Sun, 21 Aug 2005 17:08:41 -0700)
From: tjmac tolisgroup.com
Quoting Paul Howson <<email address removed>>:

> Try this:
>
> - New project. One listbox in a window. Add a few rows of data.
> - In the CellBackgroundPaint for the listbox, put "return true".
> - Run the project.
>
> When clicking on a row it still highlights in the blue highlight color.

That's the select highlight. Try adding "Return True" to your Change event and
see if you get what you're expecting.

Tim

Re: [BUG?] CellBackgroundPaint not overriding default highlighting?
Date: 22.08.05 23:45 (Tue, 23 Aug 2005 08:45:31 +1000)
From: Paul Howson
On 22/08/2005, at 10:08 AM, <email address removed> wrote:

> That's the select highlight. Try adding "Return True" to your
> Change event and
> see if you get what you're expecting.

Actually the "Change" event does not return a value. Perhaps you mean
the CellClick event? That would inhibit the change of selection.

But that is not the issue -- which is that selected cells appear to
have their background painted TWICE by RealBasic -- once before the
call to the user's CellBackgroundPaint event and then optionally
after that event if it returns false.

Paul Howson

----------------------------------------------------------------
The Design Group Qld, Warwick Qld Australia
web: www.tdgq.com.au email: <email address removed>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>