ZwinnyRolnik Posted June 16, 2010 Share Posted June 16, 2010 It's my listview Global $ListView = GUICtrlCreateListView("", 110, 80, $guiw - 220, $guih - 100) It's my additem For $i = 1 To 99 _GUICtrlListView_AddItem($ListView, $wartosc[0][$i]) Next This is what i need - expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <FontConstants.au3> #include <WinAPI.au3> Global $Font1 = _WinAPI_CreateFont(14, 6, 0, 0, $FW_BOLD) Global $Font2 = _WinAPI_CreateFont(14, 6, 0, 0, $FW_BOLD, True) $hGUI = GUICreate("Test", 300, 200) $hListView = _GUICtrlListView_Create($hGUI, "Items|SubItems", 10, 10, 280, 180, $LVS_REPORT, $WS_EX_CLIENTEDGE) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) For $i = 1 To 10 _GUICtrlListView_AddItem($hListView, "Item" & $i) _GUICtrlListView_AddSubItem($hListView, $i - 1, "SubItem" & $i, 1) Next GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _WinAPI_DeleteObject($Font1) _WinAPI_DeleteObject($Font2) Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $tNMHDR, $hWndFrom, $iCode $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hListView Switch $iCode Case $NM_CUSTOMDRAW Local $tCustDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam) Local $iDrawStage = DllStructGetData($tCustDraw, "dwDrawStage") If $iDrawStage = $CDDS_PREPAINT Then Return $CDRF_NOTIFYITEMDRAW If $iDrawStage = $CDDS_ITEMPREPAINT Then Return $CDRF_NOTIFYSUBITEMDRAW Local $iSubItem = DllStructGetData($tCustDraw, "iSubItem") Local $iItem = DllStructGetData($tCustDraw, "dwItemSpec") Local $iColor, $hDC Switch $iItem Case 5 $hDC = DllStructGetData($tCustDraw, "hdc") If $iSubItem = 0 Then $iColor = 0xFF4466 _WinAPI_SelectObject($hDC, $Font1) Else $iColor = 0x5555DD _WinAPI_SelectObject($hDC, $Font2) EndIf DllStructSetData($tCustDraw, "clrText", $iColor) Return $CDRF_NEWFONT EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY but it's doesn't work when we change: $hListView = _GUICtrlListView_Create($hGUI, "Items|SubItems", 10, 10, 280, 180, $LVS_REPORT, $WS_EX_CLIENTEDGE) with: $hListView = GUICtrlCreateListView("Items|SubItems",10,10,280,180, $LVS_REPORT, $WS_EX_CLIENTEDGE) ++ font working with... Global $hFont = _WinAPI_CreateFont(16, 6, 0, 0, 700, False, False, False, $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial') Global $ListView = GUICtrlCreateListView("", 110, 80, $guiw - 220, $guih - 100) Global $lvlv = GUICtrlGetHandle($listview) _WinAPI_SetFont($Lvlv, $hhFont, True) but coloring no pls help me ah and i don't know how join another wm_notify to my... it's my expandcollapse popupFunc WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Global $iLastItem = -1, $iLastsubitemNR = -1 Global $hGUI_Multiline, $View_Multiline, $ColName ; Multiline cell viewer window Local $tagNMHDR, $pressed,$event, $retval = $GUI_RUNDEFMSG ;, $idFrom $tagNMHDR = DllStructCreate("int;int;int", $lParam);NMHDR (hwndFrom, idFrom, code) If @error Then $tagNMHDR =0 Return EndIf ;~ $from = DllStructGetData($tagNMHDR, 1) ;~ $idFrom = DllStructGetData($tagNMHDR,2) ;ConsoleWrite("idFrom="&$idFrom&@LF) $event = DllStructGetData($tagNMHDR, 3) Select Case ($event = $HDN_TRACK or $event = $HDN_TRACKW) ;column dragging _CancelEdit() Case $MsgID = $WM_MOVING _MoveControl() Case $wParam = $__LISTVIEWCTRL Select Case $event = $LVN_ITEMCHANGED Local $ckcount = _LvGetCheckedCount($__LISTVIEWCTRL) If $LVCHECKEDCNT <> $ckcount Then $LVCHECKEDCNT = $ckcount $bLVITEMCHECKED = True _CancelEdit() EndIf Case $event = $NM_CLICK If $bLVEDITondblclick = True Then _LVGetInfo($lParam) ;scroll column into view. Switch $LVINFO[1] Case 0 _GUICtrlListView_Scroll ( $__LISTVIEWCTRL, -$LVINFO[4], 0 ) _FillLV_Info($__LISTVIEWCTRL, $LVINFO[8], $LVINFO[9], $LVINFO,0) ;_LVGetInfo($lParam) Case Else Local $ctrlSize = ControlGetPos("","",$__LISTVIEWCTRL) If $LVINFO[2]+$LVINFO[4] > $ctrlSize[2] Then _GUICtrlListView_Scroll ( $__LISTVIEWCTRL, $LVINFO[4], 0 ) _FillLV_Info($__LISTVIEWCTRL, $LVINFO[8], $LVINFO[9], $LVINFO,0) EndIf EndSwitch if Not $bLVITEMCHECKED Then _ListView_Click() EndIf Else if $editFlag = 1 Then _CancelEdit() EndIf $bLVITEMCHECKED = False; Case $event = $NM_DBLCLK _LVGetInfo($lParam) _ListView_DoubleClick() Case $event = $NM_RCLICK _LVGetInfo($lParam) _ListView_RClick() Case $event = -180 If $editFlag = 1 Then Send("{Esc}") _CancelEdit() $retval = 0 EndIf Case $event = -181 _FillLV_Info($__LISTVIEWCTRL, $LVINFO[0], $LVINFO[1], $LVINFO,0) Case $event= -121 _LVGetInfo($lParam,1) Case Else EndSelect Case $lvDate Select Case $event = $DTN_DROPDOWN $bCanceled = False $bDATECHANGED = False Case $event = $DTN_WMKEYDOWNA $pressed = _vKeyCheck() If $pressed = 27 Then _CancelEdit() Case $event = $DTN_DATETIMECHANGE If $bDATECHANGED = False Then $bDATECHANGED = True $pressed = _vKeyCheck() if $pressed = 27 Then _CancelEdit() $bDATECHANGED = False EndIf Case $event = $DTN_CLOSEUP if $bCanceled or ($bDATECHANGED = False) Then Send("{Esc}") $bDATECHANGED = False Else ; If $bLVUPDATEonfocusCHANGE = True Then Send("{Enter}") $bDATECHANGED = True ; Else ; Send("{Esc}") ; EndIf EndIf case $event = -7 $bCanceled = False $bDATECHANGED = False if $bCanceled = True Then ;or ($bDATECHANGED = False) Then Send("{Esc}") $bDATECHANGED = False $bCanceled = False Else $bDATECHANGED = True EndIf EndSelect Case $event = -326 if $editFlag Then _CancelEdit() Case $MsgID = $WM_KEYDOWN ;---------------------------------------------------------------------------------------------- ;---------------------------------------------------------------------------------------------- Case Else ;;uncomment the following line to have the edit _LVUpdate if the mouse moves ;;off of the listview. If $editFlag And Not(_HasFocus($editCtrl)) Then _LVUpdate($editCtrl, $__LISTVIEWCTRL, $LVINFO[0], $LVINFO[1]) EndSelect $tagNMHDR = 0 $event = 0 $lParam = 0 Return $retval EndFunc ;==>WM_Notify_Events Sorry for bad english. Link to comment Share on other sites More sharing options...
ZwinnyRolnik Posted June 16, 2010 Author Share Posted June 16, 2010 (edited) oh sorry it's working when we add after: $hListView = GUICtrlCreateListView("Items|SubItems",10,10,280,180, $LVS_REPORT, $WS_EX_CLIENTEDGE) this \/ $hListView = GUICtrlGetHandle($hListView) but how join this wm_notify to my wm_notify? edit: ah and another problem when i have many columns then listview lagging, look at script... u have too? maybe my computer is slow but don't think so -_^ expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <FontConstants.au3> #include <WinAPI.au3> Global $Font1 = _WinAPI_CreateFont(14, 6, 0, 0, $FW_BOLD) Global $Font2 = _WinAPI_CreateFont(14, 6, 0, 0, $FW_BOLD, True) $hGUI = GUICreate("Test", 300, 200) $hListView = GUICtrlCreateListView("Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems|Items|SubItems",10,10,280,180, $LVS_REPORT, $WS_EX_CLIENTEDGE) $hListView = GUICtrlGetHandle($hListView) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) For $i = 1 To 100 _GUICtrlListView_AddItem($hListView, "Item" & $i) _GUICtrlListView_AddSubItem($hListView, $i - 1, "SubItem" & $i, 1) Next GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _WinAPI_DeleteObject($Font1) _WinAPI_DeleteObject($Font2) Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $tNMHDR, $hWndFrom, $iCode $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hListView Switch $iCode Case $NM_CUSTOMDRAW Local $tCustDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam) Local $iDrawStage = DllStructGetData($tCustDraw, "dwDrawStage") If $iDrawStage = $CDDS_PREPAINT Then Return $CDRF_NOTIFYITEMDRAW If $iDrawStage = $CDDS_ITEMPREPAINT Then Return $CDRF_NOTIFYSUBITEMDRAW Local $iSubItem = DllStructGetData($tCustDraw, "iSubItem") Local $iItem = DllStructGetData($tCustDraw, "dwItemSpec") Local $iColor, $hDC Switch $iItem Case 5 $hDC = DllStructGetData($tCustDraw, "hdc") If $iSubItem = 0 Then $iColor = 0xFF4466 _WinAPI_SelectObject($hDC, $Font1) Else $iColor = 0x5555DD _WinAPI_SelectObject($hDC, $Font2) EndIf DllStructSetData($tCustDraw, "clrText", $iColor) Return $CDRF_NEWFONT EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Edited June 16, 2010 by ZwinnyRolnik Link to comment Share on other sites More sharing options...
ZwinnyRolnik Posted June 17, 2010 Author Share Posted June 17, 2010 pls i need it... any1? Link to comment Share on other sites More sharing options...
mikered82 Posted February 15, 2011 Share Posted February 15, 2011 Hi.I'm not sure it's what you want but here you go:Func _GUICtrlListView_SetItemColor($hListView, $iItem, $xColor) If Not IsHWnd($hListView) Then $hListView = GUICtrlGetHandle($hListView) $iReturn = GUICtrlSetColor(_GUICtrlListView_GetItemParam($hListView, $iItem), $xColor) Select Case $iReturn = 0 Return SetError(1, 0, 0) ; Failure Case $iReturn = 1 Return SetError(0, 0, 1) ; Success EndSelect EndFunc ;==> END _GUICtrlListView_SetItemColor()Thanks to wraithdu. () Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now