Jump to content

How to use $GUI_BKCOLOR_LV_ALTERNATE ?


RS200Z
 Share

Recommended Posts

Can someone explain to me how to use the special flag $GUI_BKCOLOR_LV_ALTERNATE as mentioned in the help file to create a ListView with different colors for odd and even rows.

I can't seem to find any example script of it.

Link to comment
Share on other sites

#include <GUIConstants.au3>
#include <GuiListView.au3>

Local $array[10]

$Form1 = GUICreate("AForm1", 370, 270, 193, 115)

$ListView = GUICtrlCreateListView("First Column|Second Column|Third Column", 10, 10, 350, 250)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_LV_ALTERNATE)
For $i = 1 to Ubound($array) -1
    $array[$i] = GUICtrlCreateListViewItem("stuff|stuff|stuff", $ListView)
    GUICtrlSetBkColor(-1,0xFF00FF)
Next

GUISetState(@SW_SHOW)

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

Incidently if you try using it with this method to create the listview entries _GUICtrlListViewInsertItem($ListView,-1,"stuff|stuff|stuff") it doesn't work.

Using the first method I think your limited to 4000 rows

Edited by ChrisL
Link to comment
Share on other sites

  • 3 weeks later...

Hi RS200Z,

Hope this will help (It should... It also took time for me to understand the help file guidance regarding this subject).

GUICtrlCreateListView(.....) <==== create your list view control

GUICtrlSetBkColor(-1, Put here the Hexa code for the Control Color)

GUICtrlSetBkColor(-1, $GUI_BKCOLOR_LV_ALTERNATE)

GUICtrlCreateListViewItem(....)<==== create your list view items

GUICtrlSetBkColor(-1, Put here the Hexa code for the listview item Color)

GuiSetState()

FreeRiderHonour & Fidelity

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