Listbox row info effect in REALbasic line

In this tutorial we will learn how to add a nice looking Listbox row info effect that can be found for example in Apple Mail (new messages in Inbox) or in Chronories application (number of search results). Watch it, learn it, enjoy it!

Add data to REALbasic Listbox Control

Simply add a Listbox Control to Window1 and then in Listbox1 Sub Open () enter some code… Set also the DefaultRowHeight Property to 24.

1
2
3
4
5
Listbox1.AddRow("Folders")
Listbox1.AddRow("Files")
Listbox1.AddRow("Pictures")
Listbox1.AddRow("Movies")
Listbox1.AddRow("Music")

Add info effect and format data in REALbasic Listbox

At this part we will format the look of our data, and we will also add row info effect with some random numbers inside. Add this code to Listbox1 Function CellTextPaint ().

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Dim r As New Random
 
 
if column = 0 then
 
    g.DrawString (me.Cell(row, 0), x, 18, g.Width - x, true) //draw the Listbox1.AddRow("Folders") etc.
 
end
 
 
  g.ForeColor = &cCDCDCD //change color to silver
  g.FillRoundRect(me.Width - 33, 3, 22,17, 15,15) //paint a round rectangle
 
 
  g.ForeColor = &cFDFFFB //change color to white
  g.Bold = true //bold on
  g.TextSize = 11 //change font size to 11
 
  g.DrawString(Str(r.InRange(0,9)),me.Width - 26, 15, g.Width - x, true) //draw a String with random number
 
return true

Author: Kuba Pawlak

I'm interested in all. Currently working on the development of TUTSPOLIS and I hope that in near feature the project will be successful.

4 Responses to “Listbox row info effect in REALbasic”

  1. Jakub Pawlak says:

    Premium Members will get access to RBP file tomorrow.

  2. iMacNanny222 says:

    If I already have the numbers of files on the 2nd column from a database, how could circle them, please?

  3. Jakub Pawlak says:

    Simply draw the 2nd column text.

    g.DrawString(me.Cell(row, 2),me.Width – 26, 15, g.Width – x, true)

  4. Djeff says:

    Hai … thanks for your tutorial, really good, simple and usefull.

Leave a Reply

Copyrights (c) TUTSPOLIS | Powered by Wordpress MU | Inspired at Elegant Themes designed by qbap (HTML5 & CSS3)