tomashen Posted May 25, 2014 Share Posted May 25, 2014 (edited) ive been searching and trying alot of samples on forum but nothing works how i want itto and i cant modify them >.< i am trying to create a listview with guictrlsetonevent ().. but listview isnt reacting to setonevent .. why? i just want when i click on listview items that the function get called and read what item is selected and change the text on double click i specifically looked at this for a bit of time but your method isnt returning anything to me ... i have 2 listviews in my gui Edited May 25, 2014 by tomashen Proud of AutoIt Proud of MySelf :) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 25, 2014 Moderators Share Posted May 25, 2014 (edited) tomashen,You will need to use a message handler - take a look at my GUIListViewEx UDF. M23Edit: I now see you linked to one of my scripts which uses a message handler. I would counsel against detecting single clicks on a ListView - quite often I have found them to be eaten by the control itself. I again point you to my UDF - it allows for item editing and most other things. Edited May 25, 2014 by Melba23 tomashen 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Solution tomashen Posted May 25, 2014 Author Solution Share Posted May 25, 2014 (edited) GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "GUIControl") Func GUIControl() If _WinAPI_GetFocus() <> GUICtrlGetHandle($listview) Then Return Else $iCount = _GUICtrlListView_GetSelectedCount($listview) ; Are any items selected If $iCount Then $Split = StringSplit(GUICtrlRead(GUICtrlRead($listview)), "|") If $Split[2] = "N" Then _GUICtrlListView_SetItemText($listview, _GUICtrlListView_GetSelectedIndices($listview), "Y", 1) _GUICtrlListView_JustifyColumn($listview, _GUICtrlListView_GetSelectedIndices($listview), 2) ElseIf $Split[2] = "Y" Then _GUICtrlListView_SetItemText($listview, _GUICtrlListView_GetSelectedIndices($listview), "N", 1) _GUICtrlListView_JustifyColumn($listview, _GUICtrlListView_GetSelectedIndices($listview), 2) EndIf _GUICtrlListView_SetItemSelected($listview, -1, 0, 0) EndIf EndIf EndFunc ;==>GUIControlthis changes the Y=Yes / N=No values on subitem because this is easier for me as instead of making checkboxes done this myself except i used a little snippet part of some source i cant remember where i found it ... my head is all over the place but other people will know how to use this... EDIT : bah ... fix the autoit code melba please... i try edit and edit 5 times now but everything come like that in green ... >.> Edited May 25, 2014 by Melba23 Fixed code tags Proud of AutoIt Proud of MySelf :) 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