Jump to content

List View Question


LurchMan
 Share

Recommended Posts

Hey Everyone -

I've got a simple GUI with a list view in it, and I was wondering if it was possible to make a single row in the list view a different color than all the rest instead of the entire list view. Any help will be appreciated.

Thanks!

Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Link to comment
Share on other sites

  • Moderators

LurchMan,

Does this help? :graduated:

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

LurchMan,

Does this help? :graduated:

M23

Melba -

Thanks for the reply but I can't seem to get that to work. There are a lot of errors with it and it looks like it was written with an older version of AutoIt.

Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Link to comment
Share on other sites

  • Moderators

LurchMan,

Works fine for me if I comment out line #302 in the UDF:

If $Debug_LV Then _GUICtrlListView_ValidateClassName($hWnd)

The author seems to have forgotton to include that function. :graduated:

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

Yea, I found that too, but I'm getting this error when I try and run the:

_GUICtrlListView_Formatting_Startup($GUI, $hLV)

Error:

C:\Documents and Settings\xxxxx\Desktop\LV_Format_include.au3 (189) : ==> Variable must be of type "Object".:
Local $index = $oParamSearch.Item($iParam)
Local $index = $oParamSearch^ ERROR

Before this point all I've done is build the GUI and display it.

Edit: Even when I comment out the startup function I still get the error.

Edited by LurchMan

Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Link to comment
Share on other sites

  • Moderators

LurchMan,

Does this simple script work for you with the UDF in the same folder? :graduated:

#include <GUIConstantsEx.au3>
#include 'LV_Format_include.au3'

$hGUI = GUICreate("Test", 500, 500)

$hListView = GUICtrlCreateListView("Col 1", 10, 10, 480, 200)

GUISetState()

_GUICtrlListView_Formatting_Startup($hGUI, $hListView)
_GUICtrlListView_AddOrIns_Item($hListView, "Fred")
_GUICtrlListView_AddOrIns_Item($hListView, "Fred")
_GUICtrlListView_AddOrIns_Item($hListView, "Fred")
_GUICtrlListView_AddOrIns_Item($hListView, "Fred")

_GUICtrlListView_FormattingCell($hListView, 0, 0, 0xFF0000, -1, -1, 600, 'Times New Roman')
_GUICtrlListView_FormattingCell($hListView, 1, 0, 0xFFFF00, -1, -1, 600, 'Comic Sans MS')
_GUICtrlListView_FormattingCell($hListView, 3, 0, 0xE0E0FF, -1, -1, 600, 'Courier New')

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            _GUICtrlListView_Formatting_Shutdown()
            Exit
    EndSwitch
WEnd

I get nicely coloured items with the correct fonts. :(

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

Yes that does work. Do I have to create the ListView with the standard function instead of the UDF, and add items with the one included in this udf?

Edit: Tried changing how the ListView is created and I still get the same error.

Gui:

$jobstatus = GUICreate("Job Status", 602, 476, 223, 131)
GUISetOnEvent($GUI_EVENT_CLOSE, "jobstatusClose")
$menu = GUICtrlCreateMenu("File")
$open = GUICtrlCreateMenuItem("Open File (CTRL+O)", $menu)
GUICtrlSetOnEvent(-1, "_OpenINI")
$ClearError = GUICtrlCreateMenuItem("Clear Error (F2)", $menu)
GUICtrlSetOnEvent(-1, "_ClearError")
$refresh = GUICtrlCreateMenuItem("Refresh (F5)", $menu)
GUICtrlSetOnEvent(-1, "_Refresh")
$exit = GUICtrlCreateMenuItem("Exit", $menu)
GUICtrlSetOnEvent(-1, "jobstatusClose")

$apps = GUICtrlCreateMenu("Cycle Apps")
$depends = GUICtrlCreateMenuItem("Cycle Dependencies (CTRL+D)", $apps)
GUICtrlSetOnEvent(-1, "_StartDepend")
$scheduler = GUICtrlCreateMenuItem("Cycle Scheduler (CTRL+S)", $apps)
GUICtrlSetOnEvent(-1, "_StartSch")

$ListView = _GUICtrlListView_Create($jobstatus, "Job Name|Computer|Status|Current Step|Errors|Total Run Time", 8, 0, 586, 302, _
        BitOR($LVS_REPORT, $LVS_SORTASCENDING, $LVS_AUTOARRANGE, $LVS_SHOWSELALWAYS))
_GUICtrlListView_SetExtendedListViewStyle($ListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER))

GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 100)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 150)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 100)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 75)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 4, 75)

$log = GUICtrlCreateEdit("", 8, 312, 585, 137, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_READONLY, $ES_WANTRETURN, $WS_VSCROLL))

GUICtrlSetData(-1, "")
_Refresh()
GUISetState()
Dim $jobstatus_AccelTable[5][2] = [["{F5}", $refresh],["{F2}", $ClearError],["^o", $open],["^s", $scheduler],["^d", $depends]]
GUISetAccelerators($jobstatus_AccelTable)

_GUICtrlListView_Formatting_Startup($jobstatus, $ListView)

While 1
     Sleep (100)
WEnd

Thank you for helping me sort this out.

Edited by LurchMan

Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Link to comment
Share on other sites

  • Moderators

LurchMan,

Looks like it! :(

Studying the example for a new UDF is usually the way to go - and that is exactly what I did here. :graduated:

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

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