Sign in to follow this  
Followers 0

ListView Help

6 posts in this topic

The below code updates an input field to show how many listviewitems are selected. The problem is that the $GUI_EVENT_PRIMARYUP doesn't fire when clicking on a listviewitem - only on part of the listview itself (scrollbar, emptyspace, column header, etc). I have searched the forums and there are lots of people who aparently have something similar to this working. Not sure what the problem is.

$listView= GUICtrlCreateListView("Email Lists",120+$halignInput,190+$valignInput,220,115,BitOR($LVS_REPORT, $LVS_SORTASCENDING,$LVS_NOCOLUMNHEADER))

;Then a function that adds listview items based on folder contents
;Other stuff
;Then my msg loop

        Case $msg = $GUI_EVENT_PRIMARYUP
            $pos = GUIGetCursorInfo()
            If ($pos[4] = $listView) Then

Share this post

Link to post
Share on other sites

Posted this over the weekend ... so ....


Share this post

Link to post
Share on other sites

Yep, I have the same problem.

Would like to know a solution too.

Anyone ?

D2charkeeper = No more 'expired characters' in D2.File Date Changer = Change the file date(s), attributes and the filename case of multiple files @ once.Updater_full = Copy/Update your autoitscripts, pictures, .mp3, .avi etc ... subdirs from your PC to your memory stick or to your external harddisk. Now with scheduling and logging.Questmapper

Share this post

Link to post
Share on other sites

why not use a click event instead of trying to get primary up?

; Events - ListView
#include <GuiConstants.au3>;Inclusion file for the GUI interface controls
#include <GuiListView.au3>

Global $ListView
Global Const $WM_NOTIFY = 0x004E
Global Const $DebugIt = 0

;ListView Events
Global Const $NM_FIRST = 0
Global Const $NM_CLICK = ($NM_FIRST - 2)
Global Const $NM_DBLCLK = ($NM_FIRST - 3)
#endregion End Global variables

Opt("WinTitleMatchMode", 2)

$main_GUI = GUICreate("GuiRegisterMsg Test", 225, 400, 300, 10, BitOR($WS_THICKFRAME, $WS_SIZEBOX))

$input = GUICtrlCreateInput("",5,10,120,20)

$ListView = GUICtrlCreateListView("Email Lists", 5, 75, 195, 280, BitOR($LVS_SORTASCENDING, $LVS_SINGLESEL))
_GUICtrlListViewSetColumnWidth ($ListView, 0, $LVSCW_AUTOSIZE_USEHEADER)
GUICtrlCreateListViewItem("E-Mail Name 1", $ListView)
GUICtrlCreateListViewItem("E-Mail Name 2", $ListView)

;Register WM_NOTIFY  events
GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events")

While 1
   $msg = GUIGetMsg()
   Switch $msg
    ;This case statement exits and updates code if needed
       ;put all the misc. stuff here
        Case Else

Func ListView_Click()
    If $DebugIt Then    ConsoleWrite (_DebugHeader ("$NM_CLICK"))
    GUICtrlSetData($input,_GUICtrlListViewGetItemText ($ListView))
EndFunc   ;==>ListView_Click

Func ListView_DoubleClick()
    If $DebugIt Then    ConsoleWrite (_DebugHeader ("$NM_DBLCLK"))
    MsgBox(0,"Double Clicked", _GUICtrlListViewGetItemText ($ListView))
EndFunc   ;==>ListView_DoubleClick

; WM_NOTIFY event handler
Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam)
    #forceref $hWndGUI, $MsgID, $wParam
    Local $tagNMHDR, $event, $hwndFrom, $code
    $tagNMHDR = DllStructCreate("int;int;int", $lParam) ;NMHDR (hwndFrom, idFrom, code)
    If @error Then Return
    $event = DllStructGetData($tagNMHDR, 3)
    Case $wParam = $ListView
            Case $event = $NM_CLICK
                ListView_Click ()
            Case $event = $NM_DBLCLK
                ListView_DoubleClick ()
    $tagNMHDR = 0
    $event = 0
    $lParam = 0
EndFunc   ;==>WM_Notify_Events

Func _DebugHeader($s_text)
    Return _
            "!===========================================================" & @LF & _
            "+===========================================================" & @LF & _
            "-->" & $s_text & @LF & _
            "+===========================================================" & @LF
EndFunc   ;==>_DebugHeader

SciTE for AutoItDirections for Submitting Standard UDFs


Don't argue with an idiot; people watching may not be able to tell the difference.


Share this post

Link to post
Share on other sites

Because I'm no gafrost! :D

Works as described. Thank you.

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