Thursday, May 14, 2009


REALbasic 2009 Release 2 introduces several new Listbox features, one of them is the ability to display HelpTags for a Cell. It is common to display a HelpTag when you have text that may not all fit within the cell. To show a HelpTag for a Cell, whose text cannot fit entirely, you can add this simple bit of code in your Listbox.CellTextPaint event:

Dim text As String = Me.Cell( row, column)
If g.StringWidth( text ) > g.Width Then
If Me.CellHelpTag( row, column ) = "" Then _
Me.CellHelpTag( row, column ) = text
Me.CellHelpTag( row, column ) = ""
End If

Now when you mouse over that Cell (assuming the text is long enough that it doesn't fit entirely) you will see a HelpTag appear.


Kundalini said...

Thanks William!

I've wanted this feature for a long while. I tried it, and it "sort of" works. The help text shows up nicely for 2-3 seconds when I first mouse into the listbox from some other control.

However, when I move from cell to cell within the listbox, each cell's help text just flashes up and then instantly disappears, like some sort of subliminal message!

So for now, I am getting better results by putting my code in theMouseMove event, and using the RowFromXY function to determine which cell is being visited by the mouse.

(I tested this using RB 2009 v2.1, Mac OS X 10.5.6.)


Anonymous said...

may be in future support the
multiline ?

Anonymous said...

multiline support would be very fine.

Unknown said...

You are right, it doesn't work well as you pass over cells.

I put it in the mousemove event, and did a,System.MouseX,System.MouseY,True)

and that produced an even better situation.

Unknown said...

Oops, the ToolTip() shows up in 2009R4, so you need at least that one.