Gray text in listboxes

Is it just me or has anyone else noticed that the default color of the text in listboxes has become gray rather than black since 2016r4 has been released? Even if the listbox’s g.ForeColor is set to black in the CellTextPaint event, it still comes out gray. many of my listboxes have alternate row shading and the lighter text makes some harder to read. And it’s definitely lighter than the labels on radiobuttons and checkboxes.

If it’s just me, I’ll fix it in my code but it certainly is lighter than 2016r3.

I went to the ophtalmologist lately and noticed on some circumstances the displayed text appears grey (a bit smaller for my eye to really read it) instead of ebony (black).

The ophtalmologist use computer / monitor to display the characters on screen (and the patient have to guess what the character is).

Can you make a screen shot and watch it in Paint (or other image displaying software), eventually the text may be black but appears grey to your eyes…

I don’t if my problem is related to your problem.

On listboxes of my application on Window 10 build with the latest 2016r4, i got the following.

it is prefect OK on the mac and so far i only notice this happening on the windows.

[quote=303712:@Richard Duke]I don’t if my problem is related to your problem.

On listboxes of my application on Window 10 build with the latest 2016r4, i got the following.

it is prefect OK on the mac and so far i only notice this happening on the windows.[/quote]
That looks like you’re drawing the text again in the CellTextPaint event and not returning True.

That might explain what I am seeing. In several ListBoxes, the text appears higher than it does in apps built with 2016r3 and earlier. Is the vertical position of Cell() and g.Drawstring in the Paint event no long vertically aligned? I realize that you use the x,y parameters to set the position of DrawString, and I can’t say for sure if they were exactly aligned before, but I never noticed it being off this much.

the same code has been working fine all alone until the latest version, and only on Windows.

The print seems to be done on Y, and on Y + 2. Maybe a change in 4.1 reveals an error ?

i have the following code on the celltextpaint on my listbox class

		g.Bold = False
		g.DrawStringTrucated(Me.Cell(row, column), x, y, g.Width)
		' RETURN True
		RETURN RAISEEVENT CellTextPaint(g,row,column,x,y) 

if i use the above code, i can see the double decked text and if i comment out the RETURN RAISEEVENT and take up the comment on RETURN True, it work as expected… without the double decked.

Are you returning true in CellTextPaint on the instance of your Listbox subclass?
Are you drawing any text in CellTextPaint on the instance of your Listbox subclass?

Edit: Actually, I wonder if the default text drawing in CellTextPaint is happening and that’s why.
Either way, why would you raise CellTextPaint if you’re drawing the text yourself anyway?

Might be a subclassed ListBox with it’s own CellTextPaint Event. I name mine to CellTXPaint and CellBGPaint so I there is no confusion, but that is one reason it might be like that.

Worth verifying : make sure your listbox is enabled.

I noticed 2016R4.1 had disabled all my labels in my latest project and I was wondering why they were grey, until I realized that was the issue.

[quote=303861:@Michel Bujardet]Worth verifying : make sure your listbox is enabled.

I noticed 2016R4.1 had disabled all my labels in my latest project and I was wondering why they were grey, until I realized that was the issue.[/quote]

the listbox is not disabled.

how did you add in new events for CellTXPaint and CellBGPaint??

It’s in one of the old RB guides, basically you are adding those events to occur after the Class version of the event is run. I’ll look it up when I get back, have to go pick up kids.

I’d rather see your listbox subclass. I bet it’s fixable but we just can’t see it on the forum without the code.

[quote=303840:@Richard Duke]i have the following code on the celltextpaint on my listbox class

		g.Bold = False
		g.DrawStringTrucated(Me.Cell(row, column), x, y, g.Width)
		' RETURN True
		RETURN RAISEEVENT CellTextPaint(g,row,column,x,y) 

if i use the above code, i can see the double decked text and if i comment out the RETURN RAISEEVENT and take up the comment on RETURN True, it work as expected… without the double decked.[/quote]
This code will give you fits IF you do end up drawing twice

Try

  dim retValue as Boolean = RAISEEVENT CellTextPaint(g,row,column,x,y) 
  if not retValue then 
    g.Bold = False
    g.DrawStringTrucated(Me.Cell(row, column), x, y, g.Width)
  end if
  return true

this way you wont draw twice

[quote=303877:@Norman Palardy]This code will give you fits IF you do end up drawing twice

Try

  dim retValue as Boolean = RAISEEVENT CellTextPaint(g,row,column,x,y) 
  if not retValue then 
    g.Bold = False
    g.DrawStringTrucated(Me.Cell(row, column), x, y, g.Width)
  end if
  return true

this way you wont draw twice[/quote]

this is working now… thanks…

It is sort of explained in the online user’s guide:

http://developer.xojo.com/userguide/properties-methods-and-events

look at the subtopic “Events”. But I like the more detailed explanation of how and why you might want to add this in the old Real Studio User Guide. I have the one from RB 2010r1, chapter 10, page 558, “Adding Event Definitions”. The explanation is very clear in that doc.

This is a Windows only issue and has been filed as <https://xojo.com/issue/46330>. It has been verified by the excellent Xojo folks and hopefully it can be fixed with a non-kludge workaround. (I’m lazy and don’t really want to go back and deal with it in all my apps.)

Nevertheless, I must say I’m impressed with the alternatives devised here.