Sign in to follow this  
Followers 0
Muzza

Alternate colour List View Problems

10 posts in this topic

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)

Share this post


Link to post
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


It's my job to comfort the disturbed and to disturb the comfortable.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Hi Marc,

Tried your variation and it still did not colour?

Any other ideas?

Muzza

Share this post


Link to post
Share on other sites

Hi xcal,

Tried your method and all I get is a blank screen, no table data?

I am sure i am missing something realy stupid...

thanks,

Muzza

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Then there's (likely) a mistake in your script, and you should probably post it, unless you can fix it on your own.

Edited by xcal

Share this post


Link to post
Share on other sites

Yes, there was a mistake in my script.

I cut it back to bare bones and your solution xcal worked.

thanks heaps for the help guys,

Muzza

Share this post


Link to post
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

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.

Share this post


Link to post
Share on other sites

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.

XCAL? Can anyone else help me with this please?

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