Scrubby Posted May 3, 2007 Share Posted May 3, 2007 Hi All, I'm rather perplexed here. I created a listbox in my GUI using the following line of code $listview = GUICtrlCreateListView ("Control |Name|Text|Control ID|In Rep|Check|Set",10,70,380, 220) I added two buttons to the gui that moves the data up and down in the Listview, basically so the user can change the order of the items listed in the list view. Here's the code that performs that step, it works great! Case $msg = $CtrlUpBtn $Temp = GUICtrlRead(GUICtrlRead($listview) - 1, 2) If StringInStr($Temp, "|") <> 0 Then GUICtrlSetData(GUICtrlRead($listView) - 1, GUICtrlRead(GUICtrlRead($listview), 2)) GUICtrlSetData(GUICtrlRead($listView), $Temp) Else Msgbox(0, "Cannot Move!", "Control is already at the top!") EndIf However when I press the Up button, I'd like the selected item to follow the item that was switched, instead, the selected item remains where it is, so I found the following UDF function that looks like it should do the trick for me, however, it doesn't work, I've tried the hwnd, the control id, it just blows past this line of code, doesn't generate an error and nothing on the screen happens. Any clue out there if I'm missing something? $test = _GUICtrlListSelectIndex ( $test, GUICtrlRead($listView) - 1 ) I even tried to automate it using the ControlCommand function and that didn't work and the listbox function in the autolib library as well... anyone else have an idea, or done this before successfully? Scrubby Link to comment Share on other sites More sharing options...
randallc Posted May 3, 2007 Share Posted May 3, 2007 Hi, try _GUICtrlListViewSetItemSelState ( $h_listview, $i_index [, $i_selected = 1 [, $i_focused = 0 ]] ) randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
Scrubby Posted May 7, 2007 Author Share Posted May 7, 2007 Hi, try _GUICtrlListViewSetItemSelState ( $h_listview, $i_index [, $i_selected = 1 [, $i_focused = 0 ]] ) randall That worked beautifully, thank you very much! Scrubby 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