Jump to content

Colored lines in listview.


Belini
 Share

Recommended Posts

putting different colors in listview:

#include <GuiConstants.au3>
#include <GuiListView.au3>
; ======================================
; AutoIt3 V 3.3.9.2
; Author: Belini
; Date: 03.30.2012
; Objective: Highlight rows in listview
; ======================================
$GUI = GUICreate("Listview_Colors", 200, 116, -1, -1)
$hListView = GUICtrlCreateListView("", 1, 1, 398, 298, bitor($LVS_NOCOLUMNHEADER, $LVS_NOSCROLL), $LVS_EX_GRIDLINES)
_GUICtrlListView_AddColumn($hListView, "Músicas do cd", 100)
_GUICtrlListView_AddColumn($hListView, "endereço", 200)
GUICtrlSetFont($hListView, 9, 400, 2, "arial")
GUICtrlSetBkColor($hListView, 0x233BF7)
GUICtrlSetColor($hListView, 0xFFFFFF)

GUICtrlCreateListViewItem("test 1", $hListView)
_GUICtrlListView_AddSubItem($hListView, 0, "test 1", 1)
GUICtrlSetBkColor(-1, 0xF25AF0)
GUICtrlCreateListViewItem("test 2", $hListView)
_GUICtrlListView_AddSubItem($hListView, 1, "test 2", 1)
GUICtrlSetBkColor(-1, 0x0FA327)
GUICtrlCreateListViewItem("test 3", $hListView)
_GUICtrlListView_AddSubItem($hListView, 2, "test 3", 1)
GUICtrlSetBkColor(-1, 0xF57E07)
GUICtrlCreateListViewItem("test 4", $hListView)
_GUICtrlListView_AddSubItem($hListView, 3, "test 4", 1)
GUICtrlSetBkColor(-1, 0xD1152E)
GUICtrlCreateListViewItem("test 5", $hListView)
_GUICtrlListView_AddSubItem($hListView, 4, "test 5", 1)
GUICtrlSetBkColor(-1, 0xF25AF0)
GUICtrlCreateListViewItem("test 6", $hListView)
_GUICtrlListView_AddSubItem($hListView, 5, "test 6", 1)
GUICtrlCreateListViewItem("test 7", $hListView)
GUICtrlSetBkColor(-1, 0x1C0CF7)
_GUICtrlListView_AddSubItem($hListView, 6, "test 7", 1)
GUICtrlSetBkColor(-1, 0x1F5C05)
GUISetState(@SW_SHOW, $GUI)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
Edited by Belini
Link to comment
Share on other sites

  • Moderators

ApudAngelorum,

That is a TreeView. :oops:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Link to comment
Share on other sites

ApudAngelorum,

That is a TreeView. :oops:

M23

Hmm, I've always assumed that it was a list view since it has the ability to display list view style extras info like this.

Posted Image

How do I get a tree view control to display things like the above?

Maybe I'll take this to help section..

Link to comment
Share on other sites

It's not a tree view or a list view, it's a combo of both.

Check out more information on process explorer's TreeListView here.

Thanks, but now that I dove into this I realize why there are no examples in autoit for this, it's a little complicated (or a lot).

If you want colors in ListViews (or TreeViews) then take a look at this one:

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

Adding colors, fonts, icons, images and what not is easy because there are native autoit functions intended for doing this and APIs like OPs example, it's just that I was curious because at first sight I thought OP was doing something along the lines of like what I asked, but then I realized it was just colorizing entries using native autoit functions, I don't know why I was so compulsive when I posted this :oops:, It's just that I've been getting desperate that's all..

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...