Jump to content

GUICtrlCreateListView


yucatan
 Share

Recommended Posts

i want that when i clicl on a row that it profroms a actions how do i do that when you click on it it need to be able to do someting ?

#include <GUIConstants.au3>

GUICreate("listview items",220,250, 100,200,-1,$WS_EX_ACCEPTFILES)
GUISetBkColor (0x00E0FFFF) ; will change background color

$listview = GUICtrlCreateListView ("col1  |col2|col3  ",10,10,200,150);,$LVS_SORTDESCENDING)
$button = GUICtrlCreateButton ("Value?",75,170,70,20)
$item1=GUICtrlCreateListViewItem("item2|col22|col23",$listview)
$item2=GUICtrlCreateListViewItem("item1|col12|col13",$listview)
$item3=GUICtrlCreateListViewItem("item3|col32|col33",$listview)
$input1=GUICtrlCreateInput("",20,200, 150)
GUICtrlSetState(-1,$GUI_DROPACCEPTED)  ; to allow drag and dropping
GUISetState()
GUICtrlSetData($item2,"ITEM1")
GUICtrlSetData($item3,"||COL33")
GUICtrlDelete($item1)

Do
  $msg = GUIGetMsg ()
     
   Select
      Case $msg = $button
         MsgBox(0,"listview item",GUICtrlRead(GUICtrlRead($listview)),2)
      Case $msg = $listview
         MsgBox(0,"listview", "clicked="& GUICtrlGetState($listview),2)
   EndSelect
Until $msg = $GUI_EVENT_CLOSE
Link to comment
Share on other sites

Use GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events")

and $NM_CLICK or $NM_DBLCLK

Search forum for examples ...

Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam)
 #forceref $hWndGUI, $MsgID, $wParam
 Local $tagNMHDR, $event
 
 $tagNMHDR = DllStructCreate("int;int;int", $lParam)
 If @error Then Return
 $event = DllStructGetData($tagNMHDR, 3)
 
 Select
    Case $wParam = $ListView1
        Select
            Case $event = $NM_CLICK
                onclick1()
        EndSelect
     
    Case $wParam = $ListView2
        Select
            Case $event = $NM_DBLCLK
                OnDoubleClick2()
        EndSelect
 EndSelect
 
 $tagNMHDR = 0
EndFunc
Edited by Zedna
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...