How to get sharp text in a listbox?

I searched the forum but I couldn’t find anything.

How does one get sharp text in a listbox with the g.drawstring method?
I’m using Xojo 2015r1 on a Retina Macbook pro

please post the code that is not giving good results…
I use this all the time and it looks good…

What font do you use ? Not the default one 'cause it looks good.

macOS version ?

I never actuality set a font…Mmmm.

Mac OS X 10.13.3
Listbox cells are 95 width x95 height

Listbox.celltextpaint:

dim f as FolderItem
  dim s as String
  f=me.CellTag(row,column)
  if f<>nil then
    s=f.DisplayName
    if s.Len>10 then
      s=s.Left(8)+"..."
    end if
    
    g.foreColor=RGB(250,250,250)
    g.bold = TRUE
    g.DrawString(s,g.Width/2-g.StringWidth(s)/2,80)
    
  end if
  

ps. Assigning a font doesn’t work, I still get the same fuzziness

can you post a pic of the fuzziness??
This should be fine

although I would use this to center your text

dim x as integer=(g.width-g.stringwidth(s))/2
dim y as integer=g.textascent+((g.height-g.textHeight)/2)
g.drawstring s,x,y

2015R1 doesn’t support Retina natively - you can make it work, but it requires some hacks.

Xojo 2016R1 and later offer native Retina support - see http://developer.xojo.com/2016r1-release-notes

[quote=372191:@Michael Diehr]2015R1 doesn’t support Retina natively - you can make it work, but it requires some hacks.

Xojo 2016R1 and later offer native Retina support - see http://developer.xojo.com/2016r1-release-notes[/quote]
I would assume the same.

If you have App Wrapper, you can specify “Retina” when wrapping your application as a test. If that solves it, then I would recommend that you consider upgrading to a newer version of Xojo.

Don’t draw the text yourself. Let the system do it. It should be at full resolution.

[code]dim f as FolderItem
dim s as String
f=me.CellTag(row,column)
if f<>nil then
s=f.DisplayName
if s.Len>10 then
s=s.Left(8)+"…"
end if

g.foreColor=RGB(250,250,250)
g.bold = TRUE
me.CellAlignment(row,column) = ListBox.AlignCenter

end if
Return False[/code]

Thanks guys,
I’ll test those out tonight.
Here’s a video of my listbox in action. ps. icons haven’t been made yet.

gridbox video

So it’s best to forget about the sharpness for now until I upgrade later on.

About the center text thing, I wanted the text to be centered horizontally but not vertically because there will be an icon in that location…so I still need to think about this a bit more.

Thanks again guys

[quote=372298:@Kuzey Atici]So it’s best to forget about the sharpness for now until I upgrade later on.

About the center text thing, I wanted the text to be centered horizontally but not vertically because there will be an icon in that location…so I still need to think about this a bit more.

Thanks again guys[/quote]

If you use ROWPICTURE… it will adjust the text automatically…
as a matter of fact… if you have just an Icon and some Text… no need to override CellBackgroundPaint or CellTextPaint at all

Yeah but each icon will be different in each listbox.cell(row,column), depending on what the user drags and drops there. It looks more like a gridbox instead of the normal listbox. Now if we had cellpicture that would be so nice.

// In CELLBACKGROUNDPAINT
x=5 // or what ever offset you want
y=(g.height-icon.height)/2
g.drawpicture icon,x,y,icon.width,icon.height
//
x=x+icon.width+5
 y=g.textascent+((g.height-g.textHeight)/2)
g.drawstring cell(row,column),x,y
// in CELLTEXTPAINT
return true // let CELLBACKGROUNDPAINT do all the work