Siwa Posted December 16, 2020 Share Posted December 16, 2020 Thanks, and it gave me some insight, also I managed to answer my second question, with @extended = 9 of theĀ _GUIListViewEx_EventMonitor() . But for my first question, I want to be able to add a mouseover event, not a double click. If a mouse over is not doable, then just a single click will be more convenient for me. Is it possible to do so ? Link to comment Share on other sites More sharing options...
pixelsearch Posted December 16, 2020 Share Posted December 16, 2020 Hi everybody, @Siwa: concerning your hovering request, if Melba23 thinks what follows is doable, then this could help you. @Melba23: I just tested the LVN_HOTTRACK notification code and it seems to give good results in a simple LV. As the following code concerns WM_NOTIFY, then this code could be used as described in your GUIListViewEx Guide.rtf file "...call the relevant UDF handler function from within your existing handler..." Case $LVN_HOTTRACK Local $tInfo = DllStructCreate($tagNMLISTVIEW, $lParam) If $tInfo.Item = 5 And $tInfo.SubItem = 2 Then ToolTip("Infos displayed here...") Else ToolTip("") EndIf In the example above, a tooltip would appear as soon as the user hovers over row 5 / col 2, then the tooltip disappears when not on that cell anymore. Siwa 1 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 16, 2020 Author Moderators Share Posted December 16, 2020 Siwa, You are quite right - using the @extended=9 return from _EventMonitor will allow you to detect single clicks. I need to revise the actions of my own UDF! Pixelsearch's suggestion has great merit - but you will need to play around with the code to get it to work correctly. I will take a look when I get a moment over the next few days. M23 Siwa 1 Ā AnyĀ of myĀ own codeĀ posted anywhere on the forumĀ isĀ available for use by others without any restrictionĀ of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSortĀ ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- AĀ highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort,Ā edit and colourĀ ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Ā Link to comment Share on other sites More sharing options...
Siwa Posted December 16, 2020 Share Posted December 16, 2020 Thanks Melba, I am an absolute beginner and I can not comment on anything, but I think @pixelsearch's idea might be a way to do it. As I mentioned that I'm not very good at coding, I have been playing around for about 5 hours with no luck with WM_NOTIFY. I need to find a way to solve it by your help. Link to comment Share on other sites More sharing options...
pixelsearch Posted December 16, 2020 Share Posted December 16, 2020 I just experimented it on Melba23's example GLVEx_Example_4.au3 (found in the zip package) and it seems to work. Modified / added code is found below, between commented lines starting / ending with ;<=========== expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include "GUIListViewEx.au3" #include <Array.au3> ; Just for display in example Global $iCount_Left = 20, $iCount_Right = 20, $vData, $aRet, $iEditMode = 0 ; Create GUI $hGUI = GUICreate("LVEx Example 4", 640, 430) ; Create Left ListView GUICtrlCreateLabel("Native ListView", 10, 5, 300, 35) $cListView_Left = GUICtrlCreateListView("Tom|Dick|Harry", 10, 40, 250, 300, $LVS_SHOWSELALWAYS) _GUICtrlListView_SetExtendedListViewStyle($cListView_Left, $LVS_EX_FULLROWSELECT) _GUICtrlListView_SetColumnWidth($cListView_Left, 0, 83) _GUICtrlListView_SetColumnWidth($cListView_Left, 1, 83) _GUICtrlListView_SetColumnWidth($cListView_Left, 2, 83) ; Create initial array, replacement array and fill Left listview Global $aLV_List_Left[$iCount_Left + 1] = [$iCount_Left] Global $aLV_List_Left_Replace[$iCount_Left + 1] = [$iCount_Left] For $i = 1 To UBound($aLV_List_Left) - 1 $aLV_List_Left[$i] = "Tom " & $i - 1 & "|Dick " & $i - 1 & "|Harry " & $i - 1 GUICtrlCreateListViewItem($aLV_List_Left[$i], $cListView_Left) $aLV_List_Left_Replace[$i] = "Bill " & $i - 1 & "|Ben " & $i - 1 & "|Bessie " & $i - 1 Next ; Initiate LVEx - count parameter set - blue insert mark- no drag image $iLV_Left_Index = _GUIListViewEx_Init($cListView_Left, $aLV_List_Left, 1, 0x0000FF, False) ; All columns editable _GUIListViewEx_SetEditStatus($iLV_Left_Index, "*") ; Create Right ListView GUICtrlCreateLabel("UDF ListView", 380, 5, 300, 35) $hListView_Right = _GUICtrlListView_Create($hGUI, "Peter|Paul|Mary", 380, 40, 250, 300, BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT, $WS_BORDER)) _GUICtrlListView_SetExtendedListViewStyle($hListView_Right, BitOr($LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP)) _GUICtrlListView_SetColumnWidth($hListView_Right, 0, 83) _GUICtrlListView_SetColumnWidth($cListView_Left, 1, 83) _GUICtrlListView_SetColumnWidth($cListView_Left, 2, 83) _GUICtrlListView_SetInsertMarkColor($hListView_Right, 0) ; Fill listview For $i = 0 To $iCount_Right - 1 _GUICtrlListView_AddItem($hListView_Right, "Peter " & $i) _GUICtrlListView_AddSubItem($hListView_Right, $i, "Paul " & $i, 1) _GUICtrlListView_AddSubItem($hListView_Right, $i, "Mary " & $i, 2) Next ; Read ListView content into an array $aLV_List_Right = _GUIListViewEx_ReadToArray($hListView_Right, 0) ; Initiate LVEx - no count - green insert parameter - no drag image $iLV_Right_Index = _GUIListViewEx_Init($hListView_Right, $aLV_List_Right, 0, 0x00FF00) ; Create Edit Mode Combos GUICtrlCreateLabel("Edit Modes", 280, 50, 60, 20) GUICtrlCreateLabel("0" & @CRLF & "1" & @CRLF & "2" & @CRLF & "3", 280, 70, 10, 80) GUICtrlCreateLabel(": Single Edit" & @CRLF & ": Exit Edge" & @CRLF & ": Stay Edge" & @CRLF & ": Loop Edge", 290, 70, 65, 80) GUICtrlCreateLabel("Row Mode", 280, 140, 60, 20) $cCombo_Row = GUICtrlCreateCombo("", 280, 160, 75, 20, 0x3) ; $CBS_DROPDOWNLIST GUICtrlSetData($cCombo_Row, "0|1|2|3", 0) GUICtrlCreateLabel("Col Mode", 280, 200, 60, 20) $cCombo_Col = GUICtrlCreateCombo("", 280, 220, 75, 20, 0x3) ; $CBS_DROPDOWNLIST GUICtrlSetData($cCombo_Col, "0|1|2|3", 0) GUICtrlCreateLabel("ESC Mode", 280, 260, 75, 20) $cCombo_Reset = GUICtrlCreateCombo("", 280, 280, 75, 20, 0x3) ; $CBS_DROPDOWNLIST GUICtrlSetData($cCombo_Reset, "Exit Edit|Reset All", "Exit Edit") ; Create buttons $cInsert_Button = GUICtrlCreateButton("Insert", 10, 350, 200, 30) $cDelete_Button = GUICtrlCreateButton("Delete", 10, 390, 200, 30) $cReset_Button = GUICtrlCreateButton("Reset Left", 220, 350, 200, 70) $cDisplay_Left_Button = GUICtrlCreateButton("Show Left", 430, 350, 100, 30) $cDisplay_Right_Button = GUICtrlCreateButton("Show Right", 530, 350, 100, 30) $cExit_Button = GUICtrlCreateButton("Exit", 430, 390, 200, 30) GUISetState() ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ; next line = syntax reminder pasted from GUIListViewEx.au3 ; _GUIListViewEx_MsgRegister([$fNOTIFY = True, [$fMOUSEMOVE = True, [$fLBUTTONUP = True, [ $fSYSCOMMAND = True]]]]) ; Register for dragging and editing ; _GUIListViewEx_MsgRegister() ; original line commented as WM_NOTIFY is registered in this script. ; "only set unregistered messages in _GUIListViewEx_MsgRegister" _GUIListViewEx_MsgRegister(False, True, True, True) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ; Set the right ListView as active _GUIListViewEx_SetActive(2) Switch _GUIListViewEx_GetActive() Case 0 $sMsg = "No ListView is active" Case 1 $sMsg = "The LEFT ListView is active" & @CRLF & "<--------------------------" Case 2 $sMsg = "The RIGHT ListView is active" & @CRLF & "---------------------------->" EndSwitch MsgBox(0, "Active ListView", $sMsg) MsgBox(0, "Dragging", "You can drag and reorder the headers on the right-hand ListView" & @CRLF & "---------------------------->") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $cExit_Button Exit Case $cInsert_Button ; Prepare data for insertion Switch $aGLVEx_Data[0][1] Case 1 ; Array format with single column native ListView Global $vData[1] = ["Tom " & $iCount_Left] $iCount_Left += 1 _GUIListViewEx_Insert($vData) Case 2 ; String format with single column UDF ListView $vData = "Peter " & $iCount_Right $iCount_Right += 1 _GUIListViewEx_Insert($vData) EndSwitch Case $cDelete_Button _GUIListViewEx_Delete() Case $cReset_Button ; Note parameter required for each step ; Remove current ListView from UDF _GUIListViewEx_Close($iLV_Left_Index) ; UDF index ; Delete all items _GUICtrlListView_DeleteAllItems($cListView_Left) ; ControlID/handle ; Refill the ListView with new data For $i = 1 To UBound($aLV_List_Left_Replace) - 1 GUICtrlCreateListViewItem($aLV_List_Left_Replace[$i], $cListView_Left) ; ControlID/handle Next ; Re-initiate ListView $iLV_Left_Index = _GUIListViewEx_Init($cListView_Left, $aLV_List_Left_Replace, 1, 0x0000FF, False) ; ControlID/handle ; Reset all columns editable _GUIListViewEx_SetEditStatus($iLV_Left_Index, "*") ; UDF index Case $cDisplay_Left_Button $aLV_List_Left = _GUIListViewEx_ReturnArray($iLV_Left_Index) If Not @error Then _ArrayDisplay($aLV_List_Left, "Returned Left") Else MsgBox(0, "Left", "Empty Array") EndIf Case $cDisplay_Right_Button $aLV_List_Right = _GUIListViewEx_ReturnArray($iLV_Right_Index) If Not @error Then _ArrayDisplay($aLV_List_Right, "Returned Right") Else MsgBox(0, "Right", "Empty Array") EndIf Case $cCombo_Row Switch GUICtrlRead($cCombo_Row) Case 0 GUICtrlSetData($cCombo_Col, 0) Case Else If GUICtrlRead($cCombo_Col) = 0 Then GUICtrlSetData($cCombo_Col, GUICtrlRead($cCombo_Row)) EndIf EndSwitch $iEditMode = Number(GUICtrlRead($cCombo_Row) & GUICtrlRead($cCombo_Col)) Case $cCombo_Col Switch GUICtrlRead($cCombo_Col) Case 0 GUICtrlSetData($cCombo_Row, 0) Case Else If GUICtrlRead($cCombo_Row) = 0 Then GUICtrlSetData($cCombo_Row, GUICtrlRead($cCombo_Col)) EndIf EndSwitch $iEditMode = Number(GUICtrlRead($cCombo_Row) & GUICtrlRead($cCombo_Col)) Case $cCombo_Reset ; Toggle edit mode value to switch ESC modes $iEditMode *= -1 EndSwitch $vRet = _GUIListViewEx_EventMonitor($iEditMode) ; Use combos to change EditMode If @error Then MsgBox($MB_SYSTEMMODAL, "Error", "Event error: " & @error) EndIf Switch @extended Case 0 ; No event detected Case 1 If $vRet = "" Then MsgBox($MB_SYSTEMMODAL, "Edit", "Edit aborted" & @CRLF) Else _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " content edited", Default, 8) EndIf Case 2 If $vRet = "" Then MsgBox($MB_SYSTEMMODAL, "Header edit", "Header edit aborted" & @CRLF) Else _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " header edited", Default, 8) EndIf Case 3 MsgBox($MB_SYSTEMMODAL, "Sorted", "ListView: " & $vRet & @CRLF) Case 4 MsgBox($MB_SYSTEMMODAL, "Dragged", "From : To" & @CRLF & $vRet & @CRLF) EndSwitch WEnd ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam ; "call the relevant _GUIListViewEx_WM_#####_Handler from within the existing handler" _GUIListViewEx_WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam) Local $tNMHDR, $hWndFrom, $iCode ; , $iIDFrom $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") $iCode = DllStructGetData($tNMHDR, "Code") ; $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") Switch $hWndFrom Case $hListView_Right Switch $iCode Case $LVN_HOTTRACK Local $tInfo = DllStructCreate($tagNMLISTVIEW, $lParam) If $tInfo.Item = 5 And $tInfo.SubItem = 2 Then ToolTip("Infos displayed here...") Else ToolTip("") EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ToolTip's on "Mary 5"Ā Siwa 1 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 17, 2020 Author Moderators Share Posted December 17, 2020 pixelsearch, Try pulling the mouse to the right off "Mary 5" - the tooltip remains visible until you reenter one of theĀ ListViews and a new $LVN_HOTTRACK message is sent. This is the same problem I found in my tests yesterday and what I will beĀ trying to solve today once my Spanish class is over. Imperfect subjunctives in indirect speech today - my head hurts already! M23 Siwa 1 Ā AnyĀ of myĀ own codeĀ posted anywhere on the forumĀ isĀ available for use by others without any restrictionĀ of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSortĀ ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- AĀ highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort,Ā edit and colourĀ ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Ā Link to comment Share on other sites More sharing options...
pixelsearch Posted December 17, 2020 Share Posted December 17, 2020 (edited) Maybe another approach, based on $GUI_EVENT_MOUSEMOVE ? expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include "GUIListViewEx.au3" #include <Array.au3> ; Just for display in example Global $iCount_Left = 20, $iCount_Right = 20, $vData, $aRet, $iEditMode = 0 ; Create GUI $hGUI = GUICreate("LVEx Example 4", 640, 430) ; Create Left ListView GUICtrlCreateLabel("Native ListView", 10, 5, 300, 35) $cListView_Left = GUICtrlCreateListView("Tom|Dick|Harry", 10, 40, 250, 300, $LVS_SHOWSELALWAYS) _GUICtrlListView_SetExtendedListViewStyle($cListView_Left, $LVS_EX_FULLROWSELECT) _GUICtrlListView_SetColumnWidth($cListView_Left, 0, 83) _GUICtrlListView_SetColumnWidth($cListView_Left, 1, 83) _GUICtrlListView_SetColumnWidth($cListView_Left, 2, 83) ; Create initial array, replacement array and fill Left listview Global $aLV_List_Left[$iCount_Left + 1] = [$iCount_Left] Global $aLV_List_Left_Replace[$iCount_Left + 1] = [$iCount_Left] For $i = 1 To UBound($aLV_List_Left) - 1 $aLV_List_Left[$i] = "Tom " & $i - 1 & "|Dick " & $i - 1 & "|Harry " & $i - 1 GUICtrlCreateListViewItem($aLV_List_Left[$i], $cListView_Left) $aLV_List_Left_Replace[$i] = "Bill " & $i - 1 & "|Ben " & $i - 1 & "|Bessie " & $i - 1 Next ; Initiate LVEx - count parameter set - blue insert mark- no drag image $iLV_Left_Index = _GUIListViewEx_Init($cListView_Left, $aLV_List_Left, 1, 0x0000FF, False) ; All columns editable _GUIListViewEx_SetEditStatus($iLV_Left_Index, "*") ; Create Right ListView GUICtrlCreateLabel("UDF ListView", 380, 5, 300, 35) $hListView_Right = _GUICtrlListView_Create($hGUI, "Peter|Paul|Mary", 380, 40, 250, 300, BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT, $WS_BORDER)) _GUICtrlListView_SetExtendedListViewStyle($hListView_Right, BitOr($LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP)) _GUICtrlListView_SetColumnWidth($hListView_Right, 0, 83) _GUICtrlListView_SetColumnWidth($cListView_Left, 1, 83) _GUICtrlListView_SetColumnWidth($cListView_Left, 2, 83) _GUICtrlListView_SetInsertMarkColor($hListView_Right, 0) ; Fill listview For $i = 0 To $iCount_Right - 1 _GUICtrlListView_AddItem($hListView_Right, "Peter " & $i) _GUICtrlListView_AddSubItem($hListView_Right, $i, "Paul " & $i, 1) _GUICtrlListView_AddSubItem($hListView_Right, $i, "Mary " & $i, 2) Next ; Read ListView content into an array $aLV_List_Right = _GUIListViewEx_ReadToArray($hListView_Right, 0) ; Initiate LVEx - no count - green insert parameter - no drag image $iLV_Right_Index = _GUIListViewEx_Init($hListView_Right, $aLV_List_Right, 0, 0x00FF00) ; Create Edit Mode Combos GUICtrlCreateLabel("Edit Modes", 280, 50, 60, 20) GUICtrlCreateLabel("0" & @CRLF & "1" & @CRLF & "2" & @CRLF & "3", 280, 70, 10, 80) GUICtrlCreateLabel(": Single Edit" & @CRLF & ": Exit Edge" & @CRLF & ": Stay Edge" & @CRLF & ": Loop Edge", 290, 70, 65, 80) GUICtrlCreateLabel("Row Mode", 280, 140, 60, 20) $cCombo_Row = GUICtrlCreateCombo("", 280, 160, 75, 20, 0x3) ; $CBS_DROPDOWNLIST GUICtrlSetData($cCombo_Row, "0|1|2|3", 0) GUICtrlCreateLabel("Col Mode", 280, 200, 60, 20) $cCombo_Col = GUICtrlCreateCombo("", 280, 220, 75, 20, 0x3) ; $CBS_DROPDOWNLIST GUICtrlSetData($cCombo_Col, "0|1|2|3", 0) GUICtrlCreateLabel("ESC Mode", 280, 260, 75, 20) $cCombo_Reset = GUICtrlCreateCombo("", 280, 280, 75, 20, 0x3) ; $CBS_DROPDOWNLIST GUICtrlSetData($cCombo_Reset, "Exit Edit|Reset All", "Exit Edit") ; Create buttons $cInsert_Button = GUICtrlCreateButton("Insert", 10, 350, 200, 30) $cDelete_Button = GUICtrlCreateButton("Delete", 10, 390, 200, 30) $cReset_Button = GUICtrlCreateButton("Reset Left", 220, 350, 200, 70) $cDisplay_Left_Button = GUICtrlCreateButton("Show Left", 430, 350, 100, 30) $cDisplay_Right_Button = GUICtrlCreateButton("Show Right", 530, 350, 100, 30) $cExit_Button = GUICtrlCreateButton("Exit", 430, 390, 200, 30) GUISetState() ; Register for dragging and editing _GUIListViewEx_MsgRegister() ; Set the right ListView as active _GUIListViewEx_SetActive(2) Switch _GUIListViewEx_GetActive() Case 0 $sMsg = "No ListView is active" Case 1 $sMsg = "The LEFT ListView is active" & @CRLF & "<--------------------------" Case 2 $sMsg = "The RIGHT ListView is active" & @CRLF & "---------------------------->" EndSwitch MsgBox(0, "Active ListView", $sMsg) MsgBox(0, "Dragging", "You can drag and reorder the headers on the right-hand ListView" & @CRLF & "---------------------------->") While 1 Switch GUIGetMsg() ;<================================================================ Case $GUI_EVENT_MOUSEMOVE Local $aHit = _GUICtrlListView_SubItemHitTest($hListView_Right) If $aHit[0] = 5 And $aHit[1] = 2 Then ; item / subitem ToolTip("Infos displayed here...") Else ToolTip("") EndIf ;<================================================================ Case $GUI_EVENT_CLOSE, $cExit_Button Exit Case $cInsert_Button ; Prepare data for insertion Switch $aGLVEx_Data[0][1] Case 1 ; Array format with single column native ListView Global $vData[1] = ["Tom " & $iCount_Left] $iCount_Left += 1 _GUIListViewEx_Insert($vData) Case 2 ; String format with single column UDF ListView $vData = "Peter " & $iCount_Right $iCount_Right += 1 _GUIListViewEx_Insert($vData) EndSwitch Case $cDelete_Button _GUIListViewEx_Delete() Case $cReset_Button ; Note parameter required for each step ; Remove current ListView from UDF _GUIListViewEx_Close($iLV_Left_Index) ; UDF index ; Delete all items _GUICtrlListView_DeleteAllItems($cListView_Left) ; ControlID/handle ; Refill the ListView with new data For $i = 1 To UBound($aLV_List_Left_Replace) - 1 GUICtrlCreateListViewItem($aLV_List_Left_Replace[$i], $cListView_Left) ; ControlID/handle Next ; Re-initiate ListView $iLV_Left_Index = _GUIListViewEx_Init($cListView_Left, $aLV_List_Left_Replace, 1, 0x0000FF, False) ; ControlID/handle ; Reset all columns editable _GUIListViewEx_SetEditStatus($iLV_Left_Index, "*") ; UDF index Case $cDisplay_Left_Button $aLV_List_Left = _GUIListViewEx_ReturnArray($iLV_Left_Index) If Not @error Then _ArrayDisplay($aLV_List_Left, "Returned Left") Else MsgBox(0, "Left", "Empty Array") EndIf Case $cDisplay_Right_Button $aLV_List_Right = _GUIListViewEx_ReturnArray($iLV_Right_Index) If Not @error Then _ArrayDisplay($aLV_List_Right, "Returned Right") Else MsgBox(0, "Right", "Empty Array") EndIf Case $cCombo_Row Switch GUICtrlRead($cCombo_Row) Case 0 GUICtrlSetData($cCombo_Col, 0) Case Else If GUICtrlRead($cCombo_Col) = 0 Then GUICtrlSetData($cCombo_Col, GUICtrlRead($cCombo_Row)) EndIf EndSwitch $iEditMode = Number(GUICtrlRead($cCombo_Row) & GUICtrlRead($cCombo_Col)) Case $cCombo_Col Switch GUICtrlRead($cCombo_Col) Case 0 GUICtrlSetData($cCombo_Row, 0) Case Else If GUICtrlRead($cCombo_Row) = 0 Then GUICtrlSetData($cCombo_Row, GUICtrlRead($cCombo_Col)) EndIf EndSwitch $iEditMode = Number(GUICtrlRead($cCombo_Row) & GUICtrlRead($cCombo_Col)) Case $cCombo_Reset ; Toggle edit mode value to switch ESC modes $iEditMode *= -1 EndSwitch $vRet = _GUIListViewEx_EventMonitor($iEditMode) ; Use combos to change EditMode If @error Then MsgBox($MB_SYSTEMMODAL, "Error", "Event error: " & @error) EndIf Switch @extended Case 0 ; No event detected Case 1 If $vRet = "" Then MsgBox($MB_SYSTEMMODAL, "Edit", "Edit aborted" & @CRLF) Else _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " content edited", Default, 8) EndIf Case 2 If $vRet = "" Then MsgBox($MB_SYSTEMMODAL, "Header edit", "Header edit aborted" & @CRLF) Else _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " header edited", Default, 8) EndIf Case 3 MsgBox($MB_SYSTEMMODAL, "Sorted", "ListView: " & $vRet & @CRLF) Case 4 MsgBox($MB_SYSTEMMODAL, "Dragged", "From : To" & @CRLF & $vRet & @CRLF) EndSwitch WEnd Edit: I hope your Spanish class went well today and noone said : Si estudiaras mĆ”s, sacarĆas mejores notas. Just find that sentence on a "Subjunctive ā Past or Imperfect" web page Edited December 17, 2020 by pixelsearch Musashi, Siwa and FrancescoDiMuro 1 2 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 17, 2020 Author Moderators Share Posted December 17, 2020 pixelsearch, Very nice! M23 P.S. And there was a phrase very like that - but rather more complimentary Siwa 1 Ā AnyĀ of myĀ own codeĀ posted anywhere on the forumĀ isĀ available for use by others without any restrictionĀ of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSortĀ ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- AĀ highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort,Ā edit and colourĀ ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Ā Link to comment Share on other sites More sharing options...
Siwa Posted December 17, 2020 Share Posted December 17, 2020 (edited) I did some work on it, and I wanted to view a live view, so I added an Adlibregiser to load the data as an array ( I searched a lot to find a way to load the data of the mouse over row, when the mouse is over a specific row, but couldn't; find any), then I added this : Local $aHit = _GUICtrlListView_SubItemHitTest($hcListView) If $sP_e_Status = True Then For $i=0 To UBound($sP_e)-1 If $aHit[0] = $i And $aHit[1] = 5 Then ; item / subitem If $sP_e[$i][6] > "" Then ToolTip($sP_e[$i][6]) Else ToolTip("") EndIf ElseIf $aHit[0] = $i And $aHit[1] = 1 Then ToolTip("") ElseIf $aHit[0] = $i And $aHit[1] = 2 Then ToolTip("") ElseIf $aHit[0] = $i And $aHit[1] = 3 Then ToolTip("") ElseIf $aHit[0] = $i And $aHit[1] = 4 Then ToolTip("") EndIf Next EndIf I added a hidden 6th column, then I reload he data in a 10 sec interval, then I added this code, if there is something to be shown to the user, it is only shown when the mouse is at the 5th column.Ā This is working well as intended, but there is a downside, my LV is in half of the GUI, and when the mouse is moved to where other 5th columnsĀ must be located, below the visible LV, where other buttons and labels are located, this code, is showing the tooltipĀ š Edited December 17, 2020 by Siwa Link to comment Share on other sites More sharing options...
pixelsearch Posted December 17, 2020 Share Posted December 17, 2020 (edited) @Siwa: I can reproduce the issue you described (by modifying the script above, changing $iCount_Right from 20 to 40, then "tooltipping" on Mary 30 after a change to $aHit[0] = 30) Now that there is a vertical scrolling in the listview (which wasn't the case in the example above), when "Mary 30" isn't visible in the listview but "hidden" under the buttons "Show Right" or "Exit", then the tooltip is displayed anyway when the mouse hovers the hidden "Mary 30" cell, I hope this is what you mean. A solution could be to test the mouse coords within theĀ $GUI_EVENT_MOUSEMOVE event and when mouse coords are outside the listview boundaries, then prevent the tooltip for appearing. This test could be the 1st test to check, so while mouse coords are outside the listview boundaries, then there's no use to do the SubItemHitTest. Theorically it should work, I'll test it after errands & dinner. If anyone got another idea, please let us know, thanks Edited December 17, 2020 by pixelsearch typo Siwa 1 Link to comment Share on other sites More sharing options...
Siwa Posted December 17, 2020 Share Posted December 17, 2020 (edited) That was exactly what I meant, sorry If I couldn'tĀ put my script here, it is getting bigger and bigger, and it needs an excel file to load content from. it is a smart solution, but not an appropriate one. My main goal is to solve it with the right script. But yours will do exactly what is needed. Ā Edit : This is my solution based on your suggestion, ( changed the way I read the content to useĀ _GUICtrlListView_GetItemText, which reads live content )Ā : Ā Local $aHit = _GUICtrlListView_SubItemHitTest($hcListView) For $i=0 To UBound($aLVArray)-1 If $aHit[0] = $i And $aHit[1] = 5 Then ; item / subitem Local $Mouse_Pos = MouseGetPos() Local $LV_Pos = ControlGetPos($hMainGUI, "", $cListView) Local $GUI_Pos = WinGetPos("****") If $Mouse_Pos[0]<$GUI_Pos[0]+$LV_Pos[2] And $GUI_Pos[0]+$LV_Pos[0]<$Mouse_Pos[0] And $Mouse_Pos[1]<$GUI_Pos[1]+$LV_Pos[3] And $GUI_Pos[1]+$LV_Pos[1]<$Mouse_Pos[1] Then If _GUICtrlListView_GetItemText($hcListView, $i,5) > "" Then ToolTip(_GUICtrlListView_GetItemText($hcListView, $i,6)) Else ToolTip("") EndIf Else ToolTip("") EndIf ElseIf $aHit[0] = $i And $aHit[1] = 1 Then ToolTip("") ElseIf $aHit[0] = $i And $aHit[1] = 2 Then ToolTip("") ElseIf $aHit[0] = $i And $aHit[1] = 3 Then ToolTip("") ElseIf $aHit[0] = $i And $aHit[1] = 4 Then ToolTip("") EndIf Next Ā Edited December 17, 2020 by Siwa pixelsearch 1 Link to comment Share on other sites More sharing options...
pixelsearch Posted December 17, 2020 Share Posted December 17, 2020 (edited) Done. The tooltip is on "Mary 30" in the script below. Now if you scroll vertically until "Mary 30" disappears from the LV visible area, then the tooltip won't appear anymore while the mouse hovers the 2 buttons "Show Right" or "Exit" expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include "GUIListViewEx.au3" #include <Array.au3> ; Just for display in example Global $iCount_Left = 20, $iCount_Right = 40, $vData, $aRet, $iEditMode = 0 ; Create GUI $hGUI = GUICreate("LVEx Example 4", 640, 430) ; Create Left ListView GUICtrlCreateLabel("Native ListView", 10, 5, 300, 35) $cListView_Left = GUICtrlCreateListView("Tom|Dick|Harry", 10, 40, 250, 300, $LVS_SHOWSELALWAYS) _GUICtrlListView_SetExtendedListViewStyle($cListView_Left, $LVS_EX_FULLROWSELECT) _GUICtrlListView_SetColumnWidth($cListView_Left, 0, 83) _GUICtrlListView_SetColumnWidth($cListView_Left, 1, 83) _GUICtrlListView_SetColumnWidth($cListView_Left, 2, 83) ; Create initial array, replacement array and fill Left listview Global $aLV_List_Left[$iCount_Left + 1] = [$iCount_Left] Global $aLV_List_Left_Replace[$iCount_Left + 1] = [$iCount_Left] For $i = 1 To UBound($aLV_List_Left) - 1 $aLV_List_Left[$i] = "Tom " & $i - 1 & "|Dick " & $i - 1 & "|Harry " & $i - 1 GUICtrlCreateListViewItem($aLV_List_Left[$i], $cListView_Left) $aLV_List_Left_Replace[$i] = "Bill " & $i - 1 & "|Ben " & $i - 1 & "|Bessie " & $i - 1 Next ; Initiate LVEx - count parameter set - blue insert mark- no drag image $iLV_Left_Index = _GUIListViewEx_Init($cListView_Left, $aLV_List_Left, 1, 0x0000FF, False) ; All columns editable _GUIListViewEx_SetEditStatus($iLV_Left_Index, "*") ; Create Right ListView GUICtrlCreateLabel("UDF ListView", 380, 5, 300, 35) ;<========================================== ; $hListView_Right = _GUICtrlListView_Create($hGUI, "Peter|Paul|Mary", 380, 40, 250, 300, BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT, $WS_BORDER)) Local $iLV_Width = 250, $iLV_Height = 300 $hListView_Right = _GUICtrlListView_Create($hGUI, "Peter|Paul|Mary", 380, 40, $iLV_Width, $iLV_Height, BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT, $WS_BORDER)) ;<========================================== _GUICtrlListView_SetExtendedListViewStyle($hListView_Right, BitOr($LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP)) _GUICtrlListView_SetColumnWidth($hListView_Right, 0, 83) _GUICtrlListView_SetColumnWidth($cListView_Left, 1, 83) _GUICtrlListView_SetColumnWidth($cListView_Left, 2, 83) _GUICtrlListView_SetInsertMarkColor($hListView_Right, 0) ; Fill listview For $i = 0 To $iCount_Right - 1 _GUICtrlListView_AddItem($hListView_Right, "Peter " & $i) _GUICtrlListView_AddSubItem($hListView_Right, $i, "Paul " & $i, 1) _GUICtrlListView_AddSubItem($hListView_Right, $i, "Mary " & $i, 2) Next ; Read ListView content into an array $aLV_List_Right = _GUIListViewEx_ReadToArray($hListView_Right, 0) ; Initiate LVEx - no count - green insert parameter - no drag image $iLV_Right_Index = _GUIListViewEx_Init($hListView_Right, $aLV_List_Right, 0, 0x00FF00) ; Create Edit Mode Combos GUICtrlCreateLabel("Edit Modes", 280, 50, 60, 20) GUICtrlCreateLabel("0" & @CRLF & "1" & @CRLF & "2" & @CRLF & "3", 280, 70, 10, 80) GUICtrlCreateLabel(": Single Edit" & @CRLF & ": Exit Edge" & @CRLF & ": Stay Edge" & @CRLF & ": Loop Edge", 290, 70, 65, 80) GUICtrlCreateLabel("Row Mode", 280, 140, 60, 20) $cCombo_Row = GUICtrlCreateCombo("", 280, 160, 75, 20, 0x3) ; $CBS_DROPDOWNLIST GUICtrlSetData($cCombo_Row, "0|1|2|3", 0) GUICtrlCreateLabel("Col Mode", 280, 200, 60, 20) $cCombo_Col = GUICtrlCreateCombo("", 280, 220, 75, 20, 0x3) ; $CBS_DROPDOWNLIST GUICtrlSetData($cCombo_Col, "0|1|2|3", 0) GUICtrlCreateLabel("ESC Mode", 280, 260, 75, 20) $cCombo_Reset = GUICtrlCreateCombo("", 280, 280, 75, 20, 0x3) ; $CBS_DROPDOWNLIST GUICtrlSetData($cCombo_Reset, "Exit Edit|Reset All", "Exit Edit") ; Create buttons $cInsert_Button = GUICtrlCreateButton("Insert", 10, 350, 200, 30) $cDelete_Button = GUICtrlCreateButton("Delete", 10, 390, 200, 30) $cReset_Button = GUICtrlCreateButton("Reset Left", 220, 350, 200, 70) $cDisplay_Left_Button = GUICtrlCreateButton("Show Left", 430, 350, 100, 30) $cDisplay_Right_Button = GUICtrlCreateButton("Show Right", 530, 350, 100, 30) $cExit_Button = GUICtrlCreateButton("Exit", 430, 390, 200, 30) GUISetState() ; Register for dragging and editing _GUIListViewEx_MsgRegister() ; Set the right ListView as active _GUIListViewEx_SetActive(2) Switch _GUIListViewEx_GetActive() Case 0 $sMsg = "No ListView is active" Case 1 $sMsg = "The LEFT ListView is active" & @CRLF & "<--------------------------" Case 2 $sMsg = "The RIGHT ListView is active" & @CRLF & "---------------------------->" EndSwitch MsgBox(0, "Active ListView", $sMsg) MsgBox(0, "Dragging", "You can drag and reorder the headers on the right-hand ListView" & @CRLF & "---------------------------->") While 1 Switch GUIGetMsg() ;<================================================================ Case $GUI_EVENT_MOUSEMOVE Local $aPos = MouseGetPos() _ScreenToClient($hListView_Right, $aPos) ; $aPos ByRef will be changed (+++) . Converts mouse coords to listview coords ; ConsoleWrite($aPos[0] & " / " & $aPos[1] & @crlf) If $aPos[0] < 0 Or $aPos[0] > $iLV_Width Or $aPos[1] < 0 Or $aPos[1] > $iLV_Height Then ToolTip("") ContinueLoop EndIf Local $aHit = _GUICtrlListView_SubItemHitTest($hListView_Right) If $aHit[0] = 30 And $aHit[1] = 2 Then ; item / subitem ToolTip("Infos displayed here...") Else ToolTip("") EndIf ;<================================================================ Case $GUI_EVENT_CLOSE, $cExit_Button Exit Case $cInsert_Button ; Prepare data for insertion Switch $aGLVEx_Data[0][1] Case 1 ; Array format with single column native ListView Global $vData[1] = ["Tom " & $iCount_Left] $iCount_Left += 1 _GUIListViewEx_Insert($vData) Case 2 ; String format with single column UDF ListView $vData = "Peter " & $iCount_Right $iCount_Right += 1 _GUIListViewEx_Insert($vData) EndSwitch Case $cDelete_Button _GUIListViewEx_Delete() Case $cReset_Button ; Note parameter required for each step ; Remove current ListView from UDF _GUIListViewEx_Close($iLV_Left_Index) ; UDF index ; Delete all items _GUICtrlListView_DeleteAllItems($cListView_Left) ; ControlID/handle ; Refill the ListView with new data For $i = 1 To UBound($aLV_List_Left_Replace) - 1 GUICtrlCreateListViewItem($aLV_List_Left_Replace[$i], $cListView_Left) ; ControlID/handle Next ; Re-initiate ListView $iLV_Left_Index = _GUIListViewEx_Init($cListView_Left, $aLV_List_Left_Replace, 1, 0x0000FF, False) ; ControlID/handle ; Reset all columns editable _GUIListViewEx_SetEditStatus($iLV_Left_Index, "*") ; UDF index Case $cDisplay_Left_Button $aLV_List_Left = _GUIListViewEx_ReturnArray($iLV_Left_Index) If Not @error Then _ArrayDisplay($aLV_List_Left, "Returned Left") Else MsgBox(0, "Left", "Empty Array") EndIf Case $cDisplay_Right_Button $aLV_List_Right = _GUIListViewEx_ReturnArray($iLV_Right_Index) If Not @error Then _ArrayDisplay($aLV_List_Right, "Returned Right") Else MsgBox(0, "Right", "Empty Array") EndIf Case $cCombo_Row Switch GUICtrlRead($cCombo_Row) Case 0 GUICtrlSetData($cCombo_Col, 0) Case Else If GUICtrlRead($cCombo_Col) = 0 Then GUICtrlSetData($cCombo_Col, GUICtrlRead($cCombo_Row)) EndIf EndSwitch $iEditMode = Number(GUICtrlRead($cCombo_Row) & GUICtrlRead($cCombo_Col)) Case $cCombo_Col Switch GUICtrlRead($cCombo_Col) Case 0 GUICtrlSetData($cCombo_Row, 0) Case Else If GUICtrlRead($cCombo_Row) = 0 Then GUICtrlSetData($cCombo_Row, GUICtrlRead($cCombo_Col)) EndIf EndSwitch $iEditMode = Number(GUICtrlRead($cCombo_Row) & GUICtrlRead($cCombo_Col)) Case $cCombo_Reset ; Toggle edit mode value to switch ESC modes $iEditMode *= -1 EndSwitch $vRet = _GUIListViewEx_EventMonitor($iEditMode) ; Use combos to change EditMode If @error Then MsgBox($MB_SYSTEMMODAL, "Error", "Event error: " & @error) EndIf Switch @extended Case 0 ; No event detected Case 1 If $vRet = "" Then MsgBox($MB_SYSTEMMODAL, "Edit", "Edit aborted" & @CRLF) Else _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " content edited", Default, 8) EndIf Case 2 If $vRet = "" Then MsgBox($MB_SYSTEMMODAL, "Header edit", "Header edit aborted" & @CRLF) Else _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " header edited", Default, 8) EndIf Case 3 MsgBox($MB_SYSTEMMODAL, "Sorted", "ListView: " & $vRet & @CRLF) Case 4 MsgBox($MB_SYSTEMMODAL, "Dragged", "From : To" & @CRLF & $vRet & @CRLF) EndSwitch WEnd ;<============================================ Func _ScreenToClient($hWindow, ByRef $aCoord) ; convert screen coords to $hWindow client coords (i.e mouse to listview, or listview to GUI, or mouse to header...) ; no problem if $aCoord got more than 2 elements, only the first 2 elements will be updated Local $tPoint = DllStructCreate("int X;int Y") DllStructSetData($tPoint, "X", $aCoord[0]) DllStructSetData($tPoint, "Y", $aCoord[1]) _WinAPI_ScreenToClient($hWindow, $tPoint) $aCoord[0] = DllStructGetData($tPoint, "X") $aCoord[1] = DllStructGetData($tPoint, "Y") ; ByRef modified the Array in the calling function (+++) EndFunc ;==>_ScreenToClient ;<============================================ This script should be amended in case your listview height or width change during the execution of the script. Also, if you want it to be a bit more precise, you should take care of the listview header height and the 2 eventual scrollbars (horizontal & vertical) so the tooltip won't be displayed when your mouse hover upon them while the "tooltipped" cell is just under them. Anyway, you got now a good basis to work on, because mouse coords are constantly compared to listview boundaries and : 1) If mouse coords are outside the LV boundaries => ToolTip("") 2) If they're inside => _GUICtrlListView_SubItemHitTest() Good luck Edit: I just notice you edited your last post, gonna read it again. Edited December 17, 2020 by pixelsearch Musashi and Siwa 2 Link to comment Share on other sites More sharing options...
pixelsearch Posted December 18, 2020 Share Posted December 18, 2020 (edited) Concerning this "hovering" script, this will be my final post in Melba23's thread because I'm afraid we are now polluting a bit his thread, which is initially dedicated to GUIListViewEx. In this final post, I'll present the last version of the script, which adds a "fine tuning" to the hovering process. Using MouseGetPos(), WinGetPos(), WinGetClientSize() not forgetting the LV header height (which gladly doesn't change during an eventual LV resize), all of them mixed did a fine job. Now the tooltip (cell "Mary 10" or "Mary 30") immediately disappears as soon as you hover the mouse... * over an eventual LV scrollbar (horizontal or vertical) * over the listview header area expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include "GUIListViewEx.au3" #include <Array.au3> ; Just for display in example Global $iCount_Left = 20, $iCount_Right = 40, $vData, $aRet, $iEditMode = 0 ; Create GUI $hGUI = GUICreate("LVEx Example 4", 640, 430) ; Create Left ListView GUICtrlCreateLabel("Native ListView", 10, 5, 300, 35) $cListView_Left = GUICtrlCreateListView("Tom|Dick|Harry", 10, 40, 250, 300, $LVS_SHOWSELALWAYS) _GUICtrlListView_SetExtendedListViewStyle($cListView_Left, $LVS_EX_FULLROWSELECT) _GUICtrlListView_SetColumnWidth($cListView_Left, 0, 83) _GUICtrlListView_SetColumnWidth($cListView_Left, 1, 83) _GUICtrlListView_SetColumnWidth($cListView_Left, 2, 83) ; Create initial array, replacement array and fill Left listview Global $aLV_List_Left[$iCount_Left + 1] = [$iCount_Left] Global $aLV_List_Left_Replace[$iCount_Left + 1] = [$iCount_Left] For $i = 1 To UBound($aLV_List_Left) - 1 $aLV_List_Left[$i] = "Tom " & $i - 1 & "|Dick " & $i - 1 & "|Harry " & $i - 1 GUICtrlCreateListViewItem($aLV_List_Left[$i], $cListView_Left) $aLV_List_Left_Replace[$i] = "Bill " & $i - 1 & "|Ben " & $i - 1 & "|Bessie " & $i - 1 Next ; Initiate LVEx - count parameter set - blue insert mark- no drag image $iLV_Left_Index = _GUIListViewEx_Init($cListView_Left, $aLV_List_Left, 1, 0x0000FF, False) ; All columns editable _GUIListViewEx_SetEditStatus($iLV_Left_Index, "*") ; Create Right ListView GUICtrlCreateLabel("UDF ListView", 380, 5, 300, 35) $hListView_Right = _GUICtrlListView_Create($hGUI, "Peter|Paul|Mary", 380, 40, 250, 300, BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT, $WS_BORDER)) ;<========================================== $iHeaderHeight = _WinAPI_GetWindowHeight(_GUICtrlListView_GetHeader($hListView_Right)) ;<========================================== _GUICtrlListView_SetExtendedListViewStyle($hListView_Right, BitOr($LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP)) _GUICtrlListView_SetColumnWidth($hListView_Right, 0, 83) _GUICtrlListView_SetColumnWidth($cListView_Left, 1, 83) _GUICtrlListView_SetColumnWidth($cListView_Left, 2, 83) _GUICtrlListView_SetInsertMarkColor($hListView_Right, 0) ; Fill listview For $i = 0 To $iCount_Right - 1 _GUICtrlListView_AddItem($hListView_Right, "Peter " & $i) _GUICtrlListView_AddSubItem($hListView_Right, $i, "Paul " & $i, 1) _GUICtrlListView_AddSubItem($hListView_Right, $i, "Mary " & $i, 2) Next ; Read ListView content into an array $aLV_List_Right = _GUIListViewEx_ReadToArray($hListView_Right, 0) ; Initiate LVEx - no count - green insert parameter - no drag image $iLV_Right_Index = _GUIListViewEx_Init($hListView_Right, $aLV_List_Right, 0, 0x00FF00) ; Create Edit Mode Combos GUICtrlCreateLabel("Edit Modes", 280, 50, 60, 20) GUICtrlCreateLabel("0" & @CRLF & "1" & @CRLF & "2" & @CRLF & "3", 280, 70, 10, 80) GUICtrlCreateLabel(": Single Edit" & @CRLF & ": Exit Edge" & @CRLF & ": Stay Edge" & @CRLF & ": Loop Edge", 290, 70, 65, 80) GUICtrlCreateLabel("Row Mode", 280, 140, 60, 20) $cCombo_Row = GUICtrlCreateCombo("", 280, 160, 75, 20, 0x3) ; $CBS_DROPDOWNLIST GUICtrlSetData($cCombo_Row, "0|1|2|3", 0) GUICtrlCreateLabel("Col Mode", 280, 200, 60, 20) $cCombo_Col = GUICtrlCreateCombo("", 280, 220, 75, 20, 0x3) ; $CBS_DROPDOWNLIST GUICtrlSetData($cCombo_Col, "0|1|2|3", 0) GUICtrlCreateLabel("ESC Mode", 280, 260, 75, 20) $cCombo_Reset = GUICtrlCreateCombo("", 280, 280, 75, 20, 0x3) ; $CBS_DROPDOWNLIST GUICtrlSetData($cCombo_Reset, "Exit Edit|Reset All", "Exit Edit") ; Create buttons $cInsert_Button = GUICtrlCreateButton("Insert", 10, 350, 200, 30) $cDelete_Button = GUICtrlCreateButton("Delete", 10, 390, 200, 30) $cReset_Button = GUICtrlCreateButton("Reset Left", 220, 350, 200, 70) $cDisplay_Left_Button = GUICtrlCreateButton("Show Left", 430, 350, 100, 30) $cDisplay_Right_Button = GUICtrlCreateButton("Show Right", 530, 350, 100, 30) $cExit_Button = GUICtrlCreateButton("Exit", 430, 390, 200, 30) GUISetState() ; Register for dragging and editing _GUIListViewEx_MsgRegister() ; Set the right ListView as active _GUIListViewEx_SetActive(2) Switch _GUIListViewEx_GetActive() Case 0 $sMsg = "No ListView is active" Case 1 $sMsg = "The LEFT ListView is active" & @CRLF & "<--------------------------" Case 2 $sMsg = "The RIGHT ListView is active" & @CRLF & "---------------------------->" EndSwitch MsgBox(0, "Active ListView", $sMsg) MsgBox(0, "Dragging", "You can drag and reorder the headers on the right-hand ListView" & @CRLF & "---------------------------->") ;<============================================== $bToolTip = False ; False = no tooltip displayed ;<============================================== While 1 Switch GUIGetMsg() ;<================================================================ Case $GUI_EVENT_MOUSEMOVE Local $aMPos = MouseGetPos() Local $aLVPos = WinGetPos($hListView_Right) Local $aLVCli = WinGetClientSize($hListView_Right) If $aMPos[0] < $aLVPos[0] OR $aMPos[0] > $aLVPos[0] + $aLVCli[0] _ OR $aMPos[1] <= $aLVPos[1] + $iHeaderHeight OR $aMPos[1] > $aLVPos[1] + $aLVCli[1] Then If $bToolTip Then ; a test is better than hundreds of useless forced ToolTip("") ToolTip("") $bToolTip = False EndIf ContinueLoop EndIf Local $aHit = _GUICtrlListView_SubItemHitTest($hListView_Right) If ($aHit[0] = 10 Or $aHit[0] = 30) And $aHit[1] = 2 Then ; item 10 or 30 / subitem 2 ToolTip("Infos Mary " & $aHit[0] & " displayed here...") $bToolTip = True Else If $bToolTip Then ; a test is better than hundreds of useless forced ToolTip("") ToolTip("") $bToolTip = False EndIf EndIf ;<================================================================ Case $GUI_EVENT_CLOSE, $cExit_Button Exit Case $cInsert_Button ; Prepare data for insertion Switch $aGLVEx_Data[0][1] Case 1 ; Array format with single column native ListView Global $vData[1] = ["Tom " & $iCount_Left] $iCount_Left += 1 _GUIListViewEx_Insert($vData) Case 2 ; String format with single column UDF ListView $vData = "Peter " & $iCount_Right $iCount_Right += 1 _GUIListViewEx_Insert($vData) EndSwitch Case $cDelete_Button _GUIListViewEx_Delete() Case $cReset_Button ; Note parameter required for each step ; Remove current ListView from UDF _GUIListViewEx_Close($iLV_Left_Index) ; UDF index ; Delete all items _GUICtrlListView_DeleteAllItems($cListView_Left) ; ControlID/handle ; Refill the ListView with new data For $i = 1 To UBound($aLV_List_Left_Replace) - 1 GUICtrlCreateListViewItem($aLV_List_Left_Replace[$i], $cListView_Left) ; ControlID/handle Next ; Re-initiate ListView $iLV_Left_Index = _GUIListViewEx_Init($cListView_Left, $aLV_List_Left_Replace, 1, 0x0000FF, False) ; ControlID/handle ; Reset all columns editable _GUIListViewEx_SetEditStatus($iLV_Left_Index, "*") ; UDF index Case $cDisplay_Left_Button $aLV_List_Left = _GUIListViewEx_ReturnArray($iLV_Left_Index) If Not @error Then _ArrayDisplay($aLV_List_Left, "Returned Left") Else MsgBox(0, "Left", "Empty Array") EndIf Case $cDisplay_Right_Button $aLV_List_Right = _GUIListViewEx_ReturnArray($iLV_Right_Index) If Not @error Then _ArrayDisplay($aLV_List_Right, "Returned Right") Else MsgBox(0, "Right", "Empty Array") EndIf Case $cCombo_Row Switch GUICtrlRead($cCombo_Row) Case 0 GUICtrlSetData($cCombo_Col, 0) Case Else If GUICtrlRead($cCombo_Col) = 0 Then GUICtrlSetData($cCombo_Col, GUICtrlRead($cCombo_Row)) EndIf EndSwitch $iEditMode = Number(GUICtrlRead($cCombo_Row) & GUICtrlRead($cCombo_Col)) Case $cCombo_Col Switch GUICtrlRead($cCombo_Col) Case 0 GUICtrlSetData($cCombo_Row, 0) Case Else If GUICtrlRead($cCombo_Row) = 0 Then GUICtrlSetData($cCombo_Row, GUICtrlRead($cCombo_Col)) EndIf EndSwitch $iEditMode = Number(GUICtrlRead($cCombo_Row) & GUICtrlRead($cCombo_Col)) Case $cCombo_Reset ; Toggle edit mode value to switch ESC modes $iEditMode *= -1 EndSwitch $vRet = _GUIListViewEx_EventMonitor($iEditMode) ; Use combos to change EditMode If @error Then MsgBox($MB_SYSTEMMODAL, "Error", "Event error: " & @error) EndIf Switch @extended Case 0 ; No event detected Case 1 If $vRet = "" Then MsgBox($MB_SYSTEMMODAL, "Edit", "Edit aborted" & @CRLF) Else _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " content edited", Default, 8) EndIf Case 2 If $vRet = "" Then MsgBox($MB_SYSTEMMODAL, "Header edit", "Header edit aborted" & @CRLF) Else _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " header edited", Default, 8) EndIf Case 3 MsgBox($MB_SYSTEMMODAL, "Sorted", "ListView: " & $vRet & @CRLF) Case 4 MsgBox($MB_SYSTEMMODAL, "Dragged", "From : To" & @CRLF & $vRet & @CRLF) EndSwitch WEnd Maybe a simpler script could be placed in the Example forum because it seems to be an interesting feature, not too hard to script, you just need $iHeaderHeight,Ā $bToolTip (12/18/2020) and Case $GUI_EVENT_MOUSEMOVE + a headache for the crucial line (guess which one !) For the record, I also tested this script on the listview placed at the left (native-created) with a resizable GUI ($WS_SIZEBOX style) and the "$GUI_DOCKAUTO resize mode" applied to the left LV control. Then after having resized the GUI by dragging its bottom right corner, hovering the mouse over a "tooltipped cell" in the now-resized left listview, well it still worked like a charm... just like our "Mary 10" and "Mary 30" in the listview placed at the right ! Mission accomplished Edit : 12/18/2020 : improvement by adding a flag $bToolTip (False = no tooltip actually displayed, True = a tooltip is actually displayed) Edit : 12/19/2020 : as discussed a few lines above, a simpler script concerning this listview hovering process has just been added in the Example forum in this link. Thanks Melba23 for your patience and please delete/move whatever you wantĀ that isn't related to GUIListViewEx, in the recent posts of your thread. Edited December 18, 2020 by pixelsearch Siwa 1 Link to comment Share on other sites More sharing options...
Ferropasha Posted February 16, 2021 Share Posted February 16, 2021 (edited) I want to use natural sort as a sorting algorithm for my listview columns. As I understand I should introduce the sorting function through _GUIListViewEx_UserSort, but I can't seem to find any sample code showing how and where exactly it is supposed to be used. Can anyone help me with that? Edited February 16, 2021 by Ferropasha Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 16, 2021 Author Moderators Share Posted February 16, 2021 (edited) Ferropasha, I show how to use the function in this post: https://www.autoitscript.com/forum/topic/182492-guilistviewex-bugfix-version-15-sep-20/?do=findComment&comment=1314727 Please ask if you have any more questions after having read the post. M23 Edited February 16, 2021 by Melba23 Fixed link Ā AnyĀ of myĀ own codeĀ posted anywhere on the forumĀ isĀ available for use by others without any restrictionĀ of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSortĀ ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- AĀ highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort,Ā edit and colourĀ ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Ā Link to comment Share on other sites More sharing options...
Ferropasha Posted February 16, 2021 Share Posted February 16, 2021 10 hours ago, Melba23 said: Ferropasha, I show how to use the function in this post: https://www.autoitscript.com/forum/topic/182492-guilistviewex-bugfix-version-15-sep-20/?do=findComment&comment=1314727 Please ask if you have any more questions after having read the post. M23 Thank you very much, Melba. I got it now. Link to comment Share on other sites More sharing options...
rony2006 Posted February 16, 2021 Share Posted February 16, 2021 Hello, Ā I am usingĀ _GUIListViewEx to display a list with some elements. I was able to double click on a element and get the row of selected item. Now I need to select a row, without double click, meaning I need to be able programmatically to select a item in the list. I dont think I can use colors because my list is already colored based on values from cells.Ā Ā I tried to change the color of a specific row, but then when i change the color of the next one, the previous one doesnt reset his color to the color set by the value. Ā Is there an equivalent of the following? _GUICtrlListView_SetItemSelected($idListview, 1) Ā Ā Ā Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 16, 2021 Author Moderators Share Posted February 16, 2021 (edited) rony2006, There is no equivalent ofĀ _GUICtrlListView_SetItemSelectedĀ in the UDF - I will look and see if I can provide one, but do not hold your breath. As to the colour problem, you will need to post a reproductor script or there is little I can do to help you. M23 Edit: Actually at first glance theĀ _SetItemSelected function looks pretty easy so watch this space. Edited February 16, 2021 by Melba23 rony2006 1 Ā AnyĀ of myĀ own codeĀ posted anywhere on the forumĀ isĀ available for use by others without any restrictionĀ of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSortĀ ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- AĀ highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort,Ā edit and colourĀ ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Ā Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 17, 2021 Author Moderators Share Posted February 17, 2021 rony2006, Here is a Beta UDF with a new function:Ā GUIListViewEx_Select.au3 ; #FUNCTION# ========================================================================================================= ; Name...........: _GUIListViewEx_SelectItem ; Description ...: Programatically selects a row, and item if single selection available ; Syntax.........: _GUIListViewEx_SelectItem($iRow[, $iCol]) ; Parameters ....: $iRow - 0-based row to select ; $iCol - 0-based column to select - only if single cell selection is available ; Requirement(s).: v3.3.10 + ; Return values .: Success: 1 ; Failure: 0 and sets @error as follows: ; 1 = Invalid row parameter ; 2 = Invalid column parameter ; Author ........: Melba23 ; Modified ......: ; Remarks .......: Operates on active ListView - use _GUIListViewEx_SetActive to select ; Example........: Yes ;===================================================================================================================== Please let me know if it meetsĀ your requirements. M23 robertocm 1 Ā AnyĀ of myĀ own codeĀ posted anywhere on the forumĀ isĀ available for use by others without any restrictionĀ of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSortĀ ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- AĀ highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort,Ā edit and colourĀ ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Ā Link to comment Share on other sites More sharing options...
rony2006 Posted February 17, 2021 Share Posted February 17, 2021 (edited) Thanks @Melba23 I implemented andĀ it seams that it works but there is a issue: I dont get actually the row select the same as I click on it (the blue color). But row is getting selected some how because on my list I have only 10 rows available without scroll. If i sentĀ _GUIListViewEx_SelectItem(15), my list automatically scrolls so I will have item 15 on the screen visible. I disabledĀ _GUIListViewEx_LoadColour() but the effect is the same. I am using 2 listview on the gui. And also i usedĀ _GUIListViewEx_SetActive($iLVIndex_1) before the function. I will try to make a simple script to show you the issue. Edited February 17, 2021 by rony2006 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