SupaNewb

Setting flag to true issue using wm_notify ($DTN_DATETIMECHANGE)

3 posts in this topic

Issue: If either date picker controls receive focus, then use arrow keys to change date in edit portion, flags do not set to True until mouse move or mouse click.

I have used this exact method in the past & it works perfectly. I just can't figure out what I am doing wrong here. The only thing different I can think of is I just updated my Autoit version to ;Autoit v3.3.14.0 & if it matters system I am using is running Win7 Pro x86.

#include <WindowsConstants.au3>
#include <GuiRichEdit.au3>
#include <Date.au3>
#include <DateTimeConstants.au3>
#include <GUIConstantsEx.au3>
;If either date picker controls recieve focus, then use arrow keys to change date
; in edit portion, flags do not set to True until mouse move or mouse click.
;Flags set fine when drop down is closed
Global $fdpLogChange = False, $fdpMainChange = False
Global $hDailyLogGUI, $g_id_dpDailyLog
Global $hMainGui = GUICreate("GardenBuddy", @DesktopWidth / 1.5, @DesktopHeight / 1.4, -1, -1)
Global $g_id_dpMain = GUICtrlCreateDate(_NowDate(), 8, 20, 181, 25)
Global $mView = GUICtrlCreateMenu("&View")
Global $mPlantChart = GUICtrlCreateMenuItem("Plant Chart", $mView, 0)
GUICtrlCreateMenuItem("", $mView, 1)
Global $mDailyLog = GUICtrlCreateMenuItem("Daily Log", $mView, 2)
GUISetState()
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
While 1
    $Msg = GUIGetMsg(1)
    Switch $Msg[1]
        Case $hMainGui
            Switch $Msg[0]
                Case $GUI_EVENT_CLOSE
                    GUIDelete($hMainGui)
                    Exit
                Case $mDailyLog
                    __CreateDailyLog()
                Case Else
                    If $fdpMainChange = True Then __DateChangeMain()
            EndSwitch
        Case $hDailyLogGUI
            Switch $Msg[0]
                Case $GUI_EVENT_CLOSE
                    GUIDelete($hDailyLogGUI)
                Case Else
                    If $fdpLogChange = True Then __DateChangeDL()
            EndSwitch
    EndSwitch
WEnd

Func __CreateDailyLog()
    Local $iW = @DesktopWidth / 2, $iH = @DesktopHeight / 2
    $hDailyLogGUI = GUICreate("Daily Log", $iW, $iH, -1, -1, $WS_OVERLAPPEDWINDOW)
    $g_reDailyLog = _GUICtrlRichEdit_Create($hDailyLogGUI, "", 0, 60, $iW, $iH - 110, _
            BitOR($WS_VSCROLL, $ES_WANTRETURN, $ES_AUTOVSCROLL, $ES_MULTILINE))
    _GUICtrlRichEdit_SetFont($g_reDailyLog, 12)
    $g_id_dpDailyLog = GUICtrlCreateDate(_NowDate(), 8, 20, 181, 25)
    GUISetState()
EndFunc   ;==>__CreateDailyLog

Func __DateChangeDL();Would like to be instantly notified if user changes the date through any means.
    $fdpLogChange = False
    ConsoleWrite("Log Changed" & @CRLF)
EndFunc   ;==>__DateChangeDL

Func __DateChangeMain()
    $fdpMainChange = False
    ConsoleWrite("Main Changed" & @CRLF)
EndFunc   ;==>__DateChangeMain

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo, $hWndDateDailyLog, $hWndDateMain
    $hWndDateDailyLog = GUICtrlGetHandle($g_id_dpDailyLog)
    $hWndDateMain = GUICtrlGetHandle($g_id_dpMain)
    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hWndDateDailyLog, $hWndDateMain
            Switch $iCode
                Case $DTN_DATETIMECHANGE
                    If $iIDFrom = $g_id_dpDailyLog Then $fdpLogChange = True
                    If $iIDFrom = $g_id_dpMain Then $fdpMainChange = True
                    Return 0
                Case $DTN_CLOSEUP
                    ;no return value
                Case $DTN_USERSTRING
                    Return 0
                Case $DTN_WMKEYDOWN
                    Return 0
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Because changing the date does not generate a control event (but it is the case when clicking on the control)
Move the two lines If $fdpMainChange = True and If $fdpLogChange = True outside the Switch/Case, it should work

Edited by jguinch
1 person likes this

Share this post


Link to post
Share on other sites

Because changing the date does not generate a control event (but it is the case when clicking on the control)
Move the two lines If $fdpMainChange = True and If $fdpLogChange = True outside the Switch/Case, it should work

Thanks jguinch, Works fine now!

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

  • Similar Content

    • Skysnake
      By Skysnake
      Hi
      Best example I could find is here
      ::/html/libfunctions/_GUICtrlTreeView_ClickItem.htm
      The way I understand this, the standard Windows messages, such as Left/Right Click etc are covered by AutoIt macros, but the real power is locked up inside this WM_NOTIFY .  I have tried, but I am not even sure I understand what I am looking at.
      I need help understanding this.  What I am looking for is Help file or Tutorial explaining how this works?  
      Perhaps if there is a script showing both the working of an AutoIt macro and the WM_NOTIFY  in action, it would help.
      Right now I am so lost, I do not even know what are the right questions to ask.  One issue I have is on ListViews, how to combine the "Click" of a line with a standard Switch loop?  Like users clicks a line, then get the loop to detect the click and ;do something ...
      Any ideas?
      Skysnake
    • Simpel
      By Simpel
      Hi, I created a gui with date field but formatted as time in HH:mm. It always shows "now-time". Even if I try to set it with GUICtrlSetData.
      #include <DateTimeConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Example() Func Example() GUICreate("My GUI get date", 200, 200, 800, 200) Local $idDate = GUICtrlCreateDate("", 20, 20, 100, 20, $DTS_TIMEFORMAT) ; to select a specific default format Local $sStyle = "HH:mm" ; Just display hours and minutes <<<<<<<<<<<<<<<<<<<<<<<<<<<< GUICtrlSendMsg($idDate, $DTM_SETFORMATW, 0, $sStyle) ConsoleWrite(GUICtrlRead($idDate) & @CRLF) GUICtrlSetData($idDate, "00:00") ConsoleWrite(GUICtrlRead($idDate) & @CRLF) GUISetState(@SW_SHOW) ; Loop until the user exits. While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd MsgBox($MB_SYSTEMMODAL, "Time", GUICtrlRead($idDate)) EndFunc ;==>Example How can I set the time field with another time and how can this field be set blank?
      Regards, Conrad
    • AutoBert
      By AutoBert
      I have a LV with different coloured Cols:
      ;https://autoit.de/index.php/Thread/84279-Unterschiedliche-Textfarben-innerhalb-einer-ListView/?postID=674195#post674195 #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <array.au3> #include <ListViewConstants.au3> #include <StructureConstants.au3> #include <WindowsConstants.au3> $aColBK = IniReadSection(@ScriptDir & "\lv_format.ini", "ColBKColor") _ArrayDelete($aColBK, 0) ;_ArrayDisplay($aColBK) $aRowBK = IniReadSection(@ScriptDir & "\lv_format.ini", "RowBKColor") _ArrayDelete($aRowBK, 0) ;_ArrayDisplay($aColBK) $aColText = IniReadSection(@ScriptDir & "\lv_format.ini", "ColTextColor") _ArrayDelete($aColText, 0) ;_ArrayDisplay($aColBK) $aRowText = IniReadSection(@ScriptDir & "\lv_format.ini", "RowTextColor") _ArrayDelete($aRowText, 0) ;_ArrayDisplay($aRowText) $GUI = GUICreate("Listview Farbig", 1024, 300, 0, 0) ;<==== Breite geändert $cListView = GUICtrlCreateListView("", 2, 2, 1020, 294, -1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) ;<==== Breite geändert $hListView = GUICtrlGetHandle($cListView) For $i = 1 To 31 _GUICtrlListView_InsertColumn($hListView, $i - 1, $i, 25) _GUICtrlListView_SetColumnWidth($hListView, $i - 1, 32) ;<==== eingefügt für Spaltenbreite Next For $i = 0 To 21 ; alle Item/SubItem erstellen _GUICtrlListView_AddItem($hListView, "Item: " &$i, $i) For $j = 1 To 30 _GUICtrlListView_AddSubItem($hListView, $i, "Sub: "&$j, $j) Next Next GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() While True $msg = GUIGetMsg() Switch $msg Case -3 ExitLoop EndSwitch WEnd Func WM_NOTIFY($hWnd, $msg, $wParam, $lParam) Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hListView Switch $iCode Case $NM_CUSTOMDRAW Local $tCustDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam) Local $iDrawStage, $iItem, $iSubitem, $hDC, $tRect $iDrawStage = DllStructGetData($tCustDraw, 'dwDrawStage') Switch $iDrawStage Case $CDDS_ITEMPREPAINT Return $CDRF_NOTIFYSUBITEMDRAW Case BitOR($CDDS_ITEMPREPAINT, $CDDS_SUBITEM) ; Item/SubItem das aktuell gezeichnet werden soll ermitteln $iItem = DllStructGetData($tCustDraw, 'dwItemSpec') $iSubitem = DllStructGetData($tCustDraw, 'iSubItem') Switch $iItem ; Zeilenwahl Case -1 ;kommt nicht vor ist aber notwendig, damit case else verwendet werden kann Case Else $iIndex = _ArraySearch($aRowBK, $iItem, 0, 0, 0, 0, 1, 0) If $iIndex = -1 Then ;nicht im Array für spezielle Zeilen also weiß DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR(0xFFFFFF)) Else DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($aRowBK[$iIndex][1])) ;ConsoleWrite('Item '&$iItem&' BK: '&$aRowBK[$iIndex][1] & @CRLF) EndIf $iIndex = _ArraySearch($aRowText, $iItem, 0, 0, 0, 0, 1, 0) If $iIndex = -1 Then ;nicht im Array für spezielle Zeilen also schwarz DllStructSetData($tCustDraw, 'clrText', RGB2BGR(0x000000)) Else DllStructSetData($tCustDraw, 'clrText', RGB2BGR($aRowText[$iIndex][1])) ;ConsoleWrite('Item '&$iItem&' Text: '&$aRowText[$iIndex][1] & @CRLF) EndIf EndSwitch Switch $iSubitem Case -1 ;kommt nicht vor ist aber notwendig, damit case else verwendet werden kann Case Else $iIndex = _ArraySearch($aColBK, $iSubitem, 0, 0, 0, 0, 1, 0) If $iIndex <> -1 Then DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($aColBK[$iIndex][1])) ;ConsoleWrite('SubItem '&$iSubitem&' BK: '&$aColBK[$iIndex][1] & @CRLF) EndIf $iIndex = _ArraySearch($aColText, $iSubitem, 0, 0, 0, 0, 1, 0) If $iIndex <> -1 Then DllStructSetData($tCustDraw, 'clrText', RGB2BGR($aColText[$iIndex][1])) ;ConsoleWrite('SubItem '&$iSubitem&' Text: '&$aColText[$iIndex][1] & @CRLF) EndIf EndSwitch Return $CDRF_NEWFONT EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func RGB2BGR($iColor) Local $sH = Hex($iColor, 6) Return '0x' & StringRight($sH, 2) & StringMid($sH, 3, 2) & StringLeft($sH, 2) EndFunc ;==>RGB2BGR i use lv_format.ini for defining the cols Background- and Textcolour. Now i want to colour the cols in the LV-Header also, but i can't figure it out.
       

    • kcvinu
      By kcvinu
      Hi all,
      I am trying to get the selected item text from a tree view control.
      For that i am using this code. Please take a look. In this code, i am using console write function so that i am able to know that the user clicks in an item. This code works perfectly at the first click. But when i click on an item second time, it will work twice, That means, console write will work twice. Same result is at the third and fourth click also. 
       
      Func TreeView_WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTreeview $hWndTreeview = $tv1 If Not IsHWnd($tv1) Then $hWndTreeview = GUICtrlGetHandle($tv1) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndTreeview Switch $iCode Case $TVN_SELCHANGINGW ConsoleWrite("Clicked" & @CRLF) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY  
    • DavidStark
      By DavidStark
      Hey guys,
      After much searching and reading I Siao's example script from the below link is the closest to what I need to do.
      I have a ListView that is populated with the names of different configurations.  When a Listview item is selected, a form is populated with that items data.  Right now I have a column that shows which item's data is shown in the form, but it would be much cleaner to just have the current item highlighted.
      My problem is this - The highlighting in Siao's example works great, but inside the Listview when you select in the "empty" space to essentially deselect everything the highlighting disappears.
      How can I keep the last selected item highlighted when clicking in this empty space?
      Also - I do not understand enough about Windows notifications to understand if we could utilize SendMessage to initiate a custom draw....  It seems to me that you could specify an item and then invoke the DLL function to redraw the item that you specified with the colors that you specified.... That's the idea I get when I read the MSDN documentation on it: https://msdn.microsoft.com/en-us/library/windows/desktop/ff919573(v=vs.85).aspx
       
      Siao's Example modified for latest AutoIt:
      #Include <GuiConstantsEx.au3> #Include <GuiListView.au3> #include <WindowsConstants.au3> #cs ;custom draw constants Global Const $CDDS_ITEM = 0x10000 Global Const $CDDS_MAPPART = 0x5 Global Const $CDDS_POSTERASE = 0x4 Global Const $CDDS_POSTPAINT = 0x2 Global Const $CDDS_PREERASE = 0x3 Global Const $CDDS_PREPAINT = 0x1 Global Const $CDDS_SUBITEM = 0x20000 Global Const $CDDS_ITEMPOSTERASE = BitOR($CDDS_ITEM, $CDDS_POSTERASE) Global Const $CDDS_ITEMPOSTPAINT = BitOR($CDDS_ITEM, $CDDS_POSTPAINT) Global Const $CDDS_ITEMPREERASE = BitOR($CDDS_ITEM, $CDDS_PREERASE) Global Const $CDDS_ITEMPREPAINT = BitOR($CDDS_ITEM, $CDDS_PREPAINT) Global Const $CDIS_CHECKED = 0x8 Global Const $CDIS_DEFAULT = 0x20 Global Const $CDIS_DISABLED = 0x4 Global Const $CDIS_FOCUS = 0x10 Global Const $CDIS_GRAYED = 0x2 Global Const $CDIS_HOT = 0x40 Global Const $CDIS_INDETERMINATE = 0x100 Global Const $CDIS_MARKED = 0x80 Global Const $CDIS_SELECTED = 0x1 Global Const $CDIS_SHOWKEYBOARDCUES = 0x200 Global Const $CDRF_DODEFAULT = 0x0 Global Const $CDRF_NEWFONT = 0x2 Global Const $CDRF_NOTIFYITEMDRAW = 0x20 Global Const $CDRF_NOTIFYPOSTERASE = 0x40 Global Const $CDRF_NOTIFYPOSTPAINT = 0x10 Global Const $CDRF_NOTIFYSUBITEMDRAW = 0x20 Global Const $CDRF_SKIPDEFAULT = 0x4 #ce ;fonts for custom draw example ;bold Global $aFont1 = DLLCall("gdi32.dll","int","CreateFont", "int", 14, "int", 0, "int", 0, "int", 0, "int", 700, _ "dword", 0, "dword", 0, "dword", 0, "dword", 0, "dword", 0, "dword", 0, "dword", 0, _ "dword", 0, "str", "") ;italic Global $aFont2 = DLLCall("gdi32.dll","int","CreateFont", "int", 14, "int", 0, "int", 0, "int", 0, "int", 400, _ "dword", 1, "dword", 0, "dword", 0, "dword", 0, "dword", 0, "dword", 0, "dword", 0, _ "dword", 0, "str", "") $GUI = GUICreate("Listview Custom Draw", 400, 300) $cListView = GUICtrlCreateListView("", 2, 2, 394, 268, -1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) $hListView = GUICtrlGetHandle($cListView) _GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100) _GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100) _GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100) ; Add items For $i = 1 To 30 _GUICtrlListView_AddItem($hListView, "Row" & $i & ": Col 1", $i-1) For $j = 1 To 2 _GUICtrlListView_AddSubItem ($hListView, $i-1, "Row" & $i & ": Col " & $j+1, $j) Next Next GUICtrlCreateInput("", 50, 275, 100, 15) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE DLLCall("gdi32.dll","int","DeleteObject", "hwnd", $aFont1[0]) DLLCall("gdi32.dll","int","DeleteObject", "hwnd", $aFont2[0]) Exit Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hListView Switch $iCode Case $NM_CUSTOMDRAW If Not _GUICtrlListView_GetViewDetails($hWndFrom) Then Return $GUI_RUNDEFMSG Local $tCustDraw = DllStructCreate('hwnd hwndFrom;int idFrom;int code;' & _ 'dword DrawStage;hwnd hdc;long rect[4];dword ItemSpec;int ItemState;dword Itemlparam;' & _ 'dword clrText;dword clrTextBk;int SubItem;' & _ 'dword ItemType;dword clrFace;int IconEffect;int IconPhase;int PartID;int StateID;long rectText[4];int Align', _ ;winxp or later $lParam), $iDrawStage, $iItem, $iSubitem, $hDC, $tRect, $iColor1, $iColor2, $iColor3 $iDrawStage = DllStructGetData($tCustDraw, 'DrawStage') Switch $iDrawStage Case $CDDS_PREPAINT Return $CDRF_NOTIFYITEMDRAW Case $CDDS_ITEMPREPAINT Return $CDRF_NOTIFYSUBITEMDRAW Case $CDDS_ITEMPOSTPAINT Case BitOR($CDDS_ITEMPREPAINT, $CDDS_SUBITEM) $iItem = DllStructGetData($tCustDraw, 'ItemSpec') $iSubitem = DllStructGetData($tCustDraw, 'SubItem') If _GUICtrlListView_GetItemSelected($hWndFrom, $iItem) Then $hDC = _WinAPI_GetDC($hWndFrom) $tRect = DllStructCreate('long;long;long;long') If $iSubitem = 0 Then DllCall('user32.dll','int','SendMessage', 'hwnd',$hWndFrom, 'uint',$LVM_GETSUBITEMRECT, 'wparam',$iItem, 'lparam',DllStructGetPtr($tRect)) DllStructSetData($tRect, 1, 2) DllCall('user32.dll', 'int', 'FillRect', 'ptr', $hDC, 'ptr', DllStructGetPtr($tRect), 'int', _WinAPI_GetStockObject(4)) EndIf DllStructSetData($tRect, 1, 2) DllStructSetData($tRect, 2, $iSubitem) DllCall('user32.dll','int','SendMessage', 'hwnd',$hWndFrom, 'uint',$LVM_GETSUBITEMRECT, 'wparam',$iItem, 'lparam',DllStructGetPtr($tRect)) Local $sText = _GUICtrlListView_GetItemText($hWndFrom, $iItem, $iSubitem) DLLCall("gdi32.dll","int","SetTextColor", "ptr", $hDC, "int", RGB2BGR(0xffff00)) DLLCall("gdi32.dll","int","SetBkMode", "ptr", $hDC, "int", 1) DllStructSetData($tRect, 1, DllStructGetData($tRect, 1)+2) _WinAPI_DrawText($hDC, $sText, $tRect, 0x8000) ;; $DT_END_ELLIPSIS _WinAPI_ReleaseDC($hWndFrom, $hDC) Return $CDRF_SKIPDEFAULT EndIf Switch $iItem Case 0 To 9 ;for rows 1-10 lets do this $iColor1 = RGB2BGR(0xFBFFD8) $iColor2 = RGB2BGR(-1) $iColor3 = RGB2BGR(0xFF0000) If Mod($iSubitem, 2) Then ;odd columns DllStructSetData($tCustDraw, 'clrTextBk', $iColor1) DllStructSetData($tCustDraw, 'clrText', 0) Else ;even columns DllStructSetData($tCustDraw, 'clrTextBk', $iColor2) DllStructSetData($tCustDraw, 'clrText', $iColor3) EndIf Case 10 To 19 ;for rows 11-20 lets do this $iColor1 = RGB2BGR(0xFBFFD8) $iColor2 = RGB2BGR(0x3DF8FF) $hDC = DllStructGetData($tCustDraw, 'hdc') If Mod($iItem, 2) Then If Mod($iSubitem, 2) Then DllStructSetData($tCustDraw, 'clrTextBk', $iColor1) Else DllStructSetData($tCustDraw, 'clrTextBk', $iColor2) EndIf DLLCall("gdi32.dll","hwnd","SelectObject", "hwnd", $hDC, "hwnd", $aFont1[0]) ;select our chosen font into DC Else If Mod($iSubitem, 2) Then DllStructSetData($tCustDraw, 'clrTextBk', $iColor2) Else DllStructSetData($tCustDraw, 'clrTextBk', $iColor1) EndIf DLLCall("gdi32.dll","hwnd","SelectObject", "hwnd", $hDC, "hwnd", $aFont2[0]) EndIf Case 20 To 29 ;for rows 21-30 lets do this $iColor1 = RGB2BGR(0xFBFFD8) $iColor2 = RGB2BGR(-1) If Mod($iItem, 2) Then ;odd rows DllStructSetData($tCustDraw, 'clrTextBk', $iColor2) Else DllStructSetData($tCustDraw, 'clrTextBk', $iColor1) EndIf EndSwitch Return $CDRF_NEWFONT Case BitOR($CDDS_ITEMPOSTPAINT, $CDDS_SUBITEM) Case Else EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func RGB2BGR($iColor) Return BitAND(BitShift(String(Binary($iColor)), 8), 0xFFFFFF) EndFunc Source: