Sign in to follow this  
Followers 0
Aceguy

vlistview selected column.

2 posts in this topic




#2 ·  Posted (edited)

wouldl like to return the column sleceted in a listview.

please help

#include <GuiListView.au3>
#include <GuiConstantsEx.au3>

$Gui = GUICreate("Test", 320, 220)

$hListView = _GUICtrlListView_Create($GUI, "Items|SubItems1|SubItems2", 10, 10, 300, 200, BitOR($LVS_EDITLABELS, $LVS_REPORT), $WS_EX_CLIENTEDGE)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_SUBITEMIMAGES, $LVS_EX_FULLROWSELECT))

_GUICtrlListView_SetColumnWidth($hListView, 0, 98)
_GUICtrlListView_SetColumnWidth($hListView, 1, 98)
_GUICtrlListView_SetColumnWidth($hListView, 2, 98)

GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case $GUI_EVENT_CLOSE
        ExitLoop
    EndSwitch
WEnd

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $hWndFrom, $iCode, $tNMHDR, $hWndListView, $tInfo, $iColumnIndex
    $hWndListView = $hListView
    If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iCode = DllStructGetData($tNMHDR, "Code")

    Switch $hWndFrom
    Case $hWndListView
        Switch $iCode
        Case $LVN_COLUMNCLICK
            $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
            $iColumnIndex = DllStructGetData($tInfo, "SubItem")
            MsgBox(0, "Msg", $iColumnIndex & " column clicked")
        EndSwitch
    EndSwitch
    
    Return $GUI_RUNDEFMSG
EndFunc
:) Edited by rasim

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0