Sign in to follow this  
Followers 0
sandyd

Listbox, coloring items

4 posts in this topic

A happy new year to all,

Quick question:

Whats the code to color a single item ina listbox, either the background or the foreground for the item?

Is it possible?

Thanks in adavnce.


----[ SandyD ]---

Share this post


Link to post
Share on other sites



A happy new year to all,

Quick question:

Whats the code to color a single item ina listbox, either the background or the foreground for the item?

Is it possible?

Thanks in adavnce.

it looks to me like it's impossible to set colors for a single item element of the control. i have a script where i set the font of the listview to white and the gui transparency so that it's mostly transparent when the gui isn't the active window, and i change the font color for the whole control with GUICtrlSetColor(). one thing that you could try, although i think it would probably be more work than you're willing to do; would be to get larry's UDF for writing directly to the screen, and create a text region with the same font and position as the element that you want to color. You could then give the illusion that one or more elements are different from the rest visually. If i run into enough extra time at work today, i'll see if i can't make a _guilistviewcoloritem() UDF with that concept...

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

See http://www.autoitscript.com/forum/index.php?showtopic=15110

If all else fails, you can simulate a list with TreeView in the current beta version of AutoIt. (In addition to the example below, you can look at the GUICtrlCreateTreeViewItem example in the beta help file)

#include <GuiConstants.au3>
GUICreate("My GUI with treeview", 350, 212)

$treeview = GUICtrlCreateTreeView(6, 6, 100, 150, BitOr($TVS_HASLINES, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
$a = GUICtrlCreateTreeViewitem("One Item", $treeview)
$b = GUICtrlCreateTreeViewitem("A Green Item", $treeview)
$c = GUICtrlCreateTreeViewitem("Another Item", $treeview)

GUICtrlSetColor($a, 0xFF0000)
GUICtrlSetColor($b, 0x00FF00)
GUICtrlSetColor($c, 0x0000FF)

GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

See http://www.autoitscript.com/forum/index.php?showtopic=15110

If all else fails, you can simulate a list with TreeView in the current beta version of AutoIt. (In addition to the example below, you can look at the GUICtrlCreateTreeViewItem example in the beta help file)

#include <GuiConstants.au3>
GUICreate("My GUI with treeview", 350, 212)

$treeview = GUICtrlCreateTreeView(6, 6, 100, 150, BitOr($TVS_HASLINES, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
$a = GUICtrlCreateTreeViewitem("One Item", $treeview)
$b = GUICtrlCreateTreeViewitem("A Green Item", $treeview)
$c = GUICtrlCreateTreeViewitem("Another Item", $treeview)

GUICtrlSetColor($a, 0xFF0000)
GUICtrlSetColor($b, 0x00FF00)
GUICtrlSetColor($c, 0x0000FF)

GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd
ah, very good, thanks again CS

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0