Damein Posted May 10, 2014 Posted May 10, 2014 (edited) So I have two list's side by side and I am trying to make it so you can only select one item on each list. I have it setup like this: $FavoriteListOnline = GuiCtrlCreateList("", 20,120,200,350) GUICtrlSetOnEvent(-1, "_OnlineSelected") $FavoriteListOffline = GuiCtrlCreateList("", 230,120,200,350) GUICtrlSetOnEvent(-1, "_OfflineSelected") So I have a func that I want to run (_OnlineSelected or vice versa for offline) each time someone selects an item. And if that item is in a different List I want the other list deselected. Just not quite sure the command I need to send for this to happen ^^; Thanks! Edited May 10, 2014 by Damein Most recent sig. I made Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic
Moderators Melba23 Posted May 10, 2014 Moderators Posted May 10, 2014 Damein,The only way I know is to reset the list data:#include <GUIConstantsEx.au3> $sData = "|Line 1|Line 2|Line 3|Line 4|Line 5" $hGUI = GUICreate("Test", 500, 500) $cList1 = GUICtrlCreateList("", 20, 120, 200, 350) GUICtrlSetData($cList1, $sData) $cList2 = GUICtrlCreateList("", 230, 120, 200, 350) GUICtrlSetData($cList2, $sData) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cList1 GUICtrlSetData($cList2, $sData) Case $cList2 GUICtrlSetData($cList1, $sData) EndSwitch WEndAny use? M23 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
Damein Posted May 10, 2014 Author Posted May 10, 2014 A little dirty, but it will do unless someone has a better way. Sadly, each time I reset the list I need to do a check using InetRead but it's only about 1 line of text its reading so its not a large data transfer. But we'll see. Thanks! Most recent sig. I made Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic
T0M50N Posted May 14, 2014 Posted May 14, 2014 You can do this with _GUICtrlListBox_SetCurSel($hWnd, $iIndex) If you set $iIndex to -1 it removes the selection.
Moderators Melba23 Posted May 14, 2014 Moderators Posted May 14, 2014 T0M50N,Excellent! And just to prove it: #include <GUIConstantsEx.au3> #include <GuiListBox.au3> $sData = "|Line 1|Line 2|Line 3|Line 4|Line 5" $hGUI = GUICreate("Test", 500, 500) $cList1 = GUICtrlCreateList("", 20, 120, 200, 350) GUICtrlSetData($cList1, $sData) $cList2 = GUICtrlCreateList("", 230, 120, 200, 350) GUICtrlSetData($cList2, $sData) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cList1 _GUICtrlListBox_SetCurSel($cList2, -1) Case $cList2 _GUICtrlListBox_SetCurSel($cList1, -1) EndSwitch WEndM23 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
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