Jump to content

GUIListViewEx - New Version 13 Sep 21


Recommended Posts

  • Moderators

NassauSky,

Good fun getting that to work:

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <GuiMenu.au3>
#Include "GUIListViewEx.au3"

Opt("GUIOnEventMode", 1)

Global Enum $iThis = 1000, $iThat
Global $fRightClick = False, $aHit, $fUDF = False

; Create GUI
$hGUI = GUICreate("ContextMenu NATIVE vs UDF", 640, 510)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

;--------------------------------------------------LEFT NATIVE SETUP--------------------------------------------------------------------------
$cListView_Left = GUICtrlCreateListView("", 30, 40, 200, 300, BitOR($LVS_DEFAULT, $WS_BORDER))
_GUICtrlListView_AddColumn($cListView_Left, "Column 1", 83)
_GUICtrlListView_AddColumn($cListView_Left, "Column 2", 83)
$iLV_Left_Index = _GUIListViewEx_Init($cListView_Left, "", 0, 0, True)

$ContextMenu = GUICtrlCreateContextMenu($cListView_Left)
GUICtrlCreateMenuItem("Run This", $ContextMenu, 1)
GUICtrlSetOnEvent(-1, "_myRoutine1")
GUICtrlCreateMenuItem("Run That", $ContextMenu, 2)
GUICtrlSetOnEvent(-1, "_myRoutine2")
;-------------------------------------------------RIGHT UDF SETUP------------------------------------------------------------------------------
$hListView_Right = _GUICtrlListView_Create($hGUI, "", 330, 40, 200, 300, BitOR($LVS_DEFAULT, $WS_BORDER))  ;UDF version
_GUICtrlListView_AddColumn($hListView_Right, "Column 1", 83)
_GUICtrlListView_AddColumn($hListView_Right, "Column 2", 83)
$iLV_Right_Index = _GUIListViewEx_Init($hListView_Right, "", 0, 0, True)

_GUIListViewEx_MsgRegister(False)
GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY")

GUISetState()

;-------------------------------------------------COMMON ITEM INSERTION-------------------------------------------------------------------------
_GUIListViewEx_InsertSpec($iLV_Left_Index, 0, "Row 1a Manual Wait| Test 1b")
_GUIListViewEx_InsertSpec($iLV_Left_Index, 1, "Row 2a Manual Wait| Test 2b")

_GUIListViewEx_InsertSpec($iLV_Right_Index, 0, "Row 1a Manual Wait| Test 1b")
_GUIListViewEx_InsertSpec($iLV_Right_Index, 1, "Row 2a Manual Wait| Test 2b")

While 1
    Sleep(10)
WEnd

Func _Exit()
    Exit
EndFunc

Func _myRoutine1()
    If $fUDF Then
        MsgBox($MB_SYSTEMMODAL, "RClick", "Running This" & @CRLF & $aHit[0] & "-" & $aHit[1])
        $fUDF = False
    Else
        $aContext =_GUIListViewEx_ContextPos()
        MsgBox($MB_SYSTEMMODAL, "RClick", "Running This" & @CRLF & $aContext[1] & "-" & $aContext[2])
    EndIf

EndFunc

Func _myRoutine2()
    If $fUDF Then
        MsgBox($MB_SYSTEMMODAL, "RClick", "Running That" & @CRLF & $aHit[0] & "-" & $aHit[1])
        $fUDF = False
    Else
        $aContext =_GUIListViewEx_ContextPos()
        MsgBox($MB_SYSTEMMODAL, "RClick", "Running That" & @CRLF & $aContext[1] & "-" & $aContext[2])
    EndIf
EndFunc

Func _LV_Right_RClick() ; Called inside _WM_NOTIFY

   $aHit = _GUICtrlListView_SubItemHitTest($hListView_Right)
    If $aHit[0] <> -1 Then
        $fUDF = True ; Click on UDF ListView
        $hMenu = _GUICtrlMenu_CreatePopup()
        _GUICtrlMenu_AddMenuItem($hMenu, "Run This", $iThis)
        _GUICtrlMenu_AddMenuItem($hMenu, "Run That", $iThat)
        Switch _GUICtrlMenu_TrackPopupMenu($hMenu, $hListView_Right, -1, -1, 1, 1, 2)
            Case $iThis
                _myRoutine1()
            Case $iThat
                _myRoutine2()
        EndSwitch
        _GUICtrlMenu_DestroyMenu($hMenu)
    EndIf

EndFunc

Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)

    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo

    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hListView_Right
            Switch $iCode
                Case $NM_RCLICK
                    _LV_Right_RClick()
                    Return 0
            EndSwitch
    EndSwitch

    _GUIListViewEx_WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam)

EndFunc   ;==>WM_NOTIFY

All good now?

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites
  • Replies 605
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

[NEW VERSION] - 13 Sep 21 Changed:  - A small change to the $iAdded parameter value of 512 - this used to block ALL drag/drop operations, but now only blocks INTERNAL drag/drop. So to block

I've tested the header color example as 64 bit code on both Windows 7 and Windows 10. In both cases, it fails. There are no colors in the header. Then I've made a much smaller example that only c

Hi jimmy123j, I had the same issue with the dotted rectangle when the item is focused. @LarsJ provided a solution that worked fine for me and it seems to solve your problem too. 1) Running your

Posted Images

Hello all, sorry for stupid question... I channge color row by GUICtrlSetBkColor and change text cells by _GUICtrlListView_SetItemText all ok! BUT AFTER SORTING or draging ALL CHANGES LOST! WHY???????????? T_T

 

P.S. Also i need add "open window" event after double click on row... and for work features sort and drag and my event i need rewrite  _GUIListViewEx_WM_NOTIFY_Handler just for catch  $LVN_ITEMACTIVATE o_O????? 

Edited by Mabus
Link to post
Share on other sites
  • Moderators

Mabus,

Welcome to the AutoIt forums.

With regard to the colours, at a guess you are not calling the _EventMonitor function in your idle loop - but as you post no code I cannot be more specific.

As to the "open window" event on a double click, you can use the _SetEditStatus function with $iMode = 9 to define a function to run.

So, post a short example of what you are trying to do (see here how to do it) and I will try and help yo to get it running correctly.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites

Ok maybe later i try it... ))) I so stupid and make all himself for now. (all work well) After my power go low i will try use _Ex again... =))))
Anyway thanks for help! ^_^

Edited by Mabus
Link to post
Share on other sites
  • Melba23 changed the title to GUIListViewEx - New Version 13 Sep 21
  • Moderators

[NEW VERSION] - 13 Sep 21

Changed

- A small change to the $iAdded parameter value of 512 - this used to block ALL drag/drop operations, but now only blocks INTERNAL drag/drop. So to block ALL drag/drop operations with this version you will now need to use an $iAdded value of 64+128+512. This is a script-breaking change if you use this functionality - although the change to your scripts to maintain it is not too taxing!

Fixed:

- A bug in the _Close function when there were multiple ListViews being closed.

New version in the zip in the first post.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...