Jump to content
Sign in to follow this  
blink314

Listview question

Recommended Posts

blink314

Is there any way to determine what column a user has clicked on for a listview control? I can determine the row and I know GUICtrlSetState claims you can find what column was clicked, but it doesnt work when a ListViewItem event triggers it. Any ideas? I would like to make some "cell" manipulation routines but they will be much harder if I cannot determine which cell the user clicks on!

Kevin

Share this post


Link to post
Share on other sites
GaryFrost

from the help example: not the Case $msg = $listview section

#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_ACCEPTFILES)  ; 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

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
blink314

But this doesnt work for clicking on a ListViewItem does it? It only works if you click on the column heading, right? I'm trying to get it so I can click on a ListViewItem and get the "coordinates" of the control I clicked on (ie, row 4, column 2).

Kevin

Share this post


Link to post
Share on other sites
blink314

Ahhh, ok, thanks for looking. I'll try and work around it somehow. Maybe have the user select a row then select column... I'll see. Thanks again,

Kevin

Share this post


Link to post
Share on other sites
Krass

I have the same problem now, I need the row and column.

since this topic is from the Sep 6 2005, I just ask again:

is there a possible solution to get both information which item in which row/column was clicked ?

if not, any plans to do it into the near future ? :)

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.