realbasic-games
[Top] [All Lists]

Re: listbox color

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: listbox color
From: Phil Mobley <phil at mobleybros dot com>
Date: Wed, 22 Dec 2004 15:13:04 -0800
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <20041222180029 dot 2E3F25F9F13 at lists dot realsoftware dot com> <F9503A08-546C-11D9-BCC1-0030657F569C at free dot fr>
On Dec 22, 2004, at 2:58 PM, KamaShin wrote:

I'm quite surprised to be stucked by something that seems so trivial: I use a listbox to store numbers and I'd simply like to have the negative numbers to be written in red while the positive ones would remain in black... is it even doable? I tried to play a bit around the ListBox.ActiveCell thing but this only allows the text to be in red whil the cell is in edit mode, when being validated it goes back to being written in black...

You can take over the drawing of the text [TextCellPaint() Event] and do whatever you want. This allows you to treat each listbox cell as a separate Canvas. But if you handle the text drawing yourself, you also need to handle things like shorting strings that are too long.

I used this trick myself to have multiple sizes and rows of text in a single Listbox cell. I was basing my UI on iChat.

_______________________________________________
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>

<Prev in Thread] Current Thread [Next in Thread>