Jump to content

Alternate colour List View Problems


 Share

Recommended Posts

I have cheched out the other topics re alternate colours in lists but I just can't get it to work when building the list from an array. Could someone please check this code segment and point me in the right direction.

Thanks,

Muzza

$lv_pcs = GUICtrlCreateListView("Machine|IP Address|MAC|Brand|Model|Serial|BIOS|OS|Site|DST|Brava|User", 5, 52, 1000, 462)
    
GUICtrlSetBkColor($lv_pcs, $GUI_BKCOLOR_LV_ALTERNATE)
    
For $x = 1 to UBound($f_srcArray) - 2
    
        $f_ItemData = $f_srcArray[$x][1]
            
        For $e = 2 to $f_noElements - 1
            $f_ItemData = $f_ItemData & " | " & $f_srcArray[$x][$e]
        Next
            
        _GUICtrlListViewInsertItem($f_ListToFill, -1, $f_ItemData )
        GUICtrlSetBkColor(-1,0xFF00FF)

Next

GUISetState(@SW_SHOW)
Link to comment
Share on other sites

Hi,

had the same problem - $GUI_BKCOLOR_LV_ALTERNATE does not seem to have any effect in my script. So I simply ignored it and ....

if Mod($x,2) =1 Then GUICtrlSetBkColor(-1, "0x00AAFBFF")oÝ÷ Øë­¡÷.®*.²+r";¬¶ÚâyØ­j¢Ø^ªê-®(!¶«¨·²Â¥u·­¢Ç­¶¢Z+¡ûax¸¬¶øÂÚ*ºZ׫«^ªê-jwmç(è~Ø^.+-V'°!1¶¢Z+jëh×6$lv_pcs = GUICtrlCreateListView("Machine|IP Address|MAC|Brand|Model|Serial|BIOS|OS|Site|DST|Brava|User", 5, 52, 1000, 462)
   
GUICtrlSetBkColor($lv_pcs, $GUI_BKCOLOR_LV_ALTERNATE)
   
For $x = 1 to UBound($f_srcArray) - 2
   
        $f_ItemData = $f_srcArray[$x][1]
           
        For $e = 2 to $f_noElements - 1
            $f_ItemData = $f_ItemData & " | " & $f_srcArray[$x][$e]
        Next
           
        $x= _GUICtrlListViewInsertItem($f_ListToFill, -1, $f_ItemData )
        GUICtrlSetBkColor($x,0xFF00FF)

Next

GUISetState(@SW_SHOW)

best regards,

Marc

Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL)

Link to comment
Share on other sites

#include <GUIConstants.au3>

GUICreate('', 110, 330)

$lv = GUICtrlCreateListView('some column', 10, 10, 90, 310)
GUICtrlSetBkColor($lv, 0xFFFFFF)
GUICtrlSetBkColor($lv, $GUI_BKCOLOR_LV_ALTERNATE)

For $i = 1 To 20
    GUICtrlCreateListViewItem('item ' & $i, $lv)
    GUICtrlSetBkColor(-1, 0xEEEEEE)
Next

GUISetState()

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

Link to comment
Share on other sites

  • 2 months later...

#include <GUIConstants.au3>

GUICreate('', 110, 330)

$lv = GUICtrlCreateListView('some column', 10, 10, 90, 310)
GUICtrlSetBkColor($lv, 0xFFFFFF)
GUICtrlSetBkColor($lv, $GUI_BKCOLOR_LV_ALTERNATE)

For $i = 1 To 20
    GUICtrlCreateListViewItem('item ' & $i, $lv)
    GUICtrlSetBkColor(-1, 0xEEEEEE)
Next

GUISetState()

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

XCAL,

I was wondering what I need to do to have the same effect of the alternate line color in listview with an older version of the beta?

Thanks.

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