Sign in to follow this  
Followers 0
slaughter

listwiev line colors

5 posts in this topic

now i have problem like this...

post-3048-1196197143_thumb.jpg

i nead to change backgruod line color only in one list wiev

but it changes i all program how to change only in one or few of them?

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $WM_NOTIFY = 0x004E
Local $NM_CLICK = -2
Local $NM_DBLCLK = -3
  Local $tHeader, $tDraw, $tItem, $iCode, $aItem, $hMenu

 ; Get message type
  $tHeader = DllStructCreate($tagNMHDR, $ilParam)
  Switch DllStructGetData($tHeader, "Code")
   ; Handle custom draw notification
    case $NM_CUSTOMDRAW
      $tDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $ilParam)
      Switch DllStructGetData($tDraw, "DrawStage")
        case $CDDS_PREPAINT
          Return $CDRF_NOTIFYITEMDRAW
        case $CDDS_ITEMPREPAINT
          if BitAND(DllStructGetData($tDraw, "ItemSpec"), 1) = 1 then
            DllStructSetData($tDraw, "ClrTextBk", IniRead("nustatymai.ini", "Nustaymai", "Saraso_spalva1", "0x808080") )
          else
            DllStructSetData($tDraw, "ClrTextBk", IniRead("nustatymai.ini", "Nustaymai", "Saraso_spalva2", "0xFFFFFF") )
          endif
          Return $CDRF_NEWFONT
      EndSwitch
  EndSwitch


$gui=GUICreate("Kalendorius XP",@DesktopWidth,@DesktopHeight-50,0,0)
GUISetBkColor (IniRead("nustatymai.ini", "Nustaymai", "Spalva", "0xE0FFFF"))

$listview = GUICtrlCreateListView ("Laikas  |Kiekis |Veiksmas|alys|Kontaktai|Pastabos|Darbuotojas  ",10,270,@DesktopWidth/2-20,@DesktopHeight-270-50-30, $LVS_SHOWSELALWAYS,$LVS_EX_GRIDLINES+$LVS_EX_FULLROWSELECT)


$darbuotojai=GUICreate("Drbuotojai",530, 600, -1, -1,$WS_SYSMENU ,0,$gui)
$darbuotojai_listx = GUICtrlCreateListView ("  Vardas  |  Pavardė  |  Telefonas  |  Adresas     |  Gimimo data |Pareigos",10,10,500,450)
$darb_button_1 = GUICtrlCreateButton("Naujas darbuotojas", 10, 470, 100, 20)
$darb_button_2 = GUICtrlCreateButton("Keisti pasirinktus duomenis", 110, 470, 150, 20)
$darb_button_3 = GUICtrlCreateButton("Itrinti pasirinktą", 390, 470, 100, 20)

this is a peace of code... all script is huge... so if any more of it neaded request i will post

Share this post


Link to post
Share on other sites



You need to add a switch case for the controlid/handle that you only want line colors to work on.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

As Gary said.

Here is code snippet from my app:

...
$ListView1 = GUICtrlCreateListView("", 25, 33, 266, 118)
$ListView2 = GUICtrlCreateListView("", 328, 33, 261, 118, BitOR($LVS_REPORT,$LVS_SINGLESEL,$LVS_SHOWSELALWAYS,$LVS_SORTASCENDING,$WS_VSCROLL))
...
GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events")
...

Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam)
    #forceref $hWndGUI, $MsgID, $wParam
    Local $tagNMHDR, $event
        $tagNMHDR = DllStructCreate("int;int;int", $lParam)
    If @error Then Return
    $event = DllStructGetData($tagNMHDR, 3)
        Select
        Case $wParam = $ListView1
            Select
                Case $event = $NM_CLICK
                    OnListView1Click()
            EndSelect
                    Case $wParam = $ListView2
            Select
                Case $event = $NM_DBLCLK
                    OnListView2DoubleClick()
            EndSelect
    EndSelect
EndFunc
Edited by Zedna

Share this post


Link to post
Share on other sites

Hi,

I have the same problem.

Ich want to color a line.

But only the whole listview will be colored

#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
Opt('MustDeclareVars', 1)
$Debug_LV = False; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work
Global $hListView, $test, $farbe
 Local $GUI, $hImage
 $GUI = GUICreate("(External) ListView Create", 400, 300)
 $hListView = _GUICtrlListView_Create ($GUI, "", 2, 2, 394, 268)
 _GUICtrlListView_SetExtendedListViewStyle ($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
 GUISetState()
; Add columns
 _GUICtrlListView_InsertColumn ($hListView, 0, "Column 1", 100)
 _GUICtrlListView_InsertColumn ($hListView, 1, "Column 2", 100)
; Add items
 _GUICtrlListView_AddItem ($hListView, "1", 0)
 _GUICtrlListView_AddItem ($hListView, "2", 1)
 _GUICtrlListView_AddItem ($hListView, "3", 1)
 
 For $i = 0 to 2
  $test = _GUICtrlListView_GetItemText($hListView, $i, 0)
;~   MsgBox(0,"", $test)
  If $test = 2 Then 
   MsgBox(0,$i, "färben")
   $farbe = _GUICtrlListView_SetTextColor($hListView, 0xFFA500)
   MsgBox(0,$i, $farbe)
  EndIf
 Next
; Loop until user exits
 Do
 Until GUIGetMsg() = $GUI_EVENT_CLOSE
 GUIDelete()

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