walle Posted February 20, 2008 Share Posted February 20, 2008 Well, haven't found the command in helpfile. Any idea? _GUICtrlListView_GetItemState($LISTVIEW1,"",$LVIS_SELECTED) didn't work out ;Listbox, works _GUICtrlListBox_GetText($LISTBOX1, _GUICtrlListBox_GetCurSel($LISTBOX1)) ;This dosn't work. _GUICtrlListView_GetItemText($LISTVIEW1, _GUICtrlListView_GetItemSelected($LISTVIEW1)) Link to comment Share on other sites More sharing options...
GEOSoft Posted February 20, 2008 Share Posted February 20, 2008 Well, haven't found the command in helpfile. Any idea? _GUICtrlListView_GetItemState($LISTVIEW1,"",$LVIS_SELECTED) didn't work out ;Listbox, works _GUICtrlListBox_GetText($LISTBOX1, _GUICtrlListBox_GetCurSel($LISTBOX1)) ;This dosn't work. _GUICtrlListView_GetItemText($LISTVIEW1, _GUICtrlListView_GetItemSelected($LISTVIEW1))Look in the help file for _GUICtrlListView_GetItemSelected() Note that there is a difference between a ListBox and a ListView. ListBox functions are not intended to work on a listView control George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
FreeFry Posted February 20, 2008 Share Posted February 20, 2008 From the helpfile:_GUICtrlListView_GetItemSelected --------------------------------------------------------------------------------Determines whether the item is selectedReturn ValueSuccess: TrueFailure: False_GUICtrlListView_GetItemSelected retrieves whether the item is selected or not, not the item index.That's probably why it ain't working, never worked with these functions so I wouldn't know. Link to comment Share on other sites More sharing options...
GEOSoft Posted February 20, 2008 Share Posted February 20, 2008 From the helpfile:_GUICtrlListView_GetItemSelected retrieves whether the item is selected or not, not the item index.That's probably why it ain't working, never worked with these functions so I wouldn't know. You are correct. Looks like it will now be_GUICtrlListView_GetSelectedIndices() George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
rasim Posted February 20, 2008 Share Posted February 20, 2008 (edited) From the help: expandcollapse popup#include <GUIConstants.au3> #include <GuiListView.au3> $hGui = GUICreate("Test", 200, 100) $hListView = _GUICtrlListView_Create($hGui, "Items|SubItems", 10, 10, 180, 80, BitOR($LVS_REPORT, $LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $WS_CLIPSIBLINGS), $WS_EX_CLIENTEDGE) _GUICtrlListView_AddItem($hListView, "Item1") _GUICtrlListView_AddItem($hListView, "Item2") GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() Do $msg = GUIGetMsg () Until $msg = $GUI_EVENT_CLOSE Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $tNMHDR, $hWndFrom, $iCode, $tInfo, $iIndex $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hListView Switch $iCode Case $NM_CLICK $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) $iIndex = DllStructGetData($tInfo, "Index") If $iIndex <> -1 Then MsgBox(0, "Message", "Item " & $iIndex & " selected") EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Edited February 20, 2008 by rasim Link to comment Share on other sites More sharing options...
walle Posted February 20, 2008 Author Share Posted February 20, 2008 (edited) You are correct. Looks like it will now be _GUICtrlListView_GetSelectedIndices() Well, that seems to work. But Im still a bit confused. Here are three different situations. The second example won't return the item text. Any idea why? Returns a value, for example 1. _GUICtrlListView_GetSelectedIndices($Listview1)oÝ÷ Ùº¹çºYZºÚ"µÍÑÕRPÝÝY]×ÑÙ]][U^ ÌÍÓÝY]ÌKÑÕRPÝÝY]×ÑÙ]Ù[XÝY[XÙÊ ÌÍÓÝY]ÌJJoÝ÷ Ùº¹ì¶¢µé¬©¡ö®¶seôuT7G&ÄÆ7EfWuôvWDFVÕFWBb33c´Æ7GfWs Thanks for the help so far! Edited February 20, 2008 by walle Link to comment Share on other sites More sharing options...
GaryFrost Posted February 20, 2008 Share Posted February 20, 2008 You need to cast the indice as an int _GUICtrlListView_GetItemText($Listview1, Int(_GUICtrlListView_GetSelectedIndices($Listview1))) SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
GEOSoft Posted February 20, 2008 Share Posted February 20, 2008 (edited) Well, that seems to work. But Im still a bit confused. Here are three different situations. The second example won't return the item text. Any idea why? Returns a value, for example 1. _GUICtrlListView_GetSelectedIndices($Listview1)oÝ÷ Ùº¹çºYZºÚ"µÍÑÕRPÝÝY]×ÑÙ]][U^ ÌÍÓÝY]ÌKÑÕRPÝÝY]×ÑÙ]Ù[XÝY[XÙÊ ÌÍÓÝY]ÌJJoÝ÷ Ùº¹ì¶¢µé¬©¡ö®¶seôuT7G&ÄÆ7EfWuôvWDFVÕFWBb33c´Æ7GfWs Thanks for the help so far!Damn AutoIt tags screwed up your code AGAIN!! I wish people would just quit using those things. I don't like the pretty colors anyway. $Idx = Int(_GUICtrlListView_GetSelectedIndices($Listview1)) $i_Txt = _GUICtrlListView_GetItemText($Listview1, $Idx) msgBox(0, "TEST", $i_Txt) Edited February 20, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now