Sign in to follow this  
Followers 0
burger

Listview in Color?

5 posts in this topic

post-14759-1161517638_thumb.pngIs it possible to create a colored grid such as this using a GUIListview control? If not, any other suggestions would be appreciated. Thanks.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

post-14759-1161517638_thumb.pngIs it possible to create a colored grid such as this using a GUIListview control? If not, any other suggestions would be appreciated. Thanks.

What have you tried?

#include <GUIConstants.au3>

$Main = GUICreate("listview items",220,250, 100,200,-1,$WS_EX_ACCEPTFILES)
GUISetBkColor (0x00E0FFFF)  ; will change background color

$listview = GUICtrlCreateListView ("col1  |col2|col3  ",10,10,200,150,-1, $LVS_EX_GRIDLINES)
$button = GUICtrlCreateButton ("Value?",75,170,70,20)
$item1=GUICtrlCreateListViewItem("item2|col22|col23",$listview)
$item2=GUICtrlCreateListViewItem("item1|col12|col13",$listview)
$item3=GUICtrlCreateListViewItem("item3|col32|col33",$listview)
$input1=GUICtrlCreateInput("",20,200, 150)
GUICtrlSetState(-1,$GUI_DROPACCEPTED)   ; to allow drag and dropping
GUISetState()
GUICtrlSetData($item2,"ITEM1")
GUICtrlSetData($item3,"||COL33")
GUICtrlDelete($item1)

Do
  $msg = GUIGetMsg ()
     
   Select
    Case $msg = $button
        GUISetState(@SW_LOCK, $Main)
        GUICtrlSetBkColor($listview, 0xff0000)
        GUISetState(@SW_UNLOCK, $Main)
   EndSelect
Until $msg = $GUI_EVENT_CLOSE
Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

I've tried reading the help file to see if there is any reference to color. There is none.

Share this post


Link to post
Share on other sites

I've tried reading the help file to see if there is any reference to color. There is none.

So GUICtrlSetBkColor and GUICtrlSetColor aren't references to GUI and Colors?

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Thank you for your help. I should have been more clear. I'm trying to vary the color of the cells based on the value in the cells. I didn't see anything in the ListView help. I will probably have to take a different approach. I was only hoping to use ListView because it would save creating the grid by hand.

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