redndahead Posted July 12, 2004 Share Posted July 12, 2004 On a gui read while selecting multiple values in a list box it returns to me the values that are not selected. Any clue on why this is happening? red Link to comment Share on other sites More sharing options...
redndahead Posted July 12, 2004 Author Share Posted July 12, 2004 update it isn't that it returns the unselected items it is that it returns the last item clicked. I am going to try to use control command to get the selections. red Link to comment Share on other sites More sharing options...
redndahead Posted July 12, 2004 Author Share Posted July 12, 2004 Well that didn't work either it only gave me one value. How can I return the value of the multiple selections? red Link to comment Share on other sites More sharing options...
Holger Posted July 12, 2004 Share Posted July 12, 2004 Ok, with GUI-commands I think it's not possible.But maybe it's possible to modify the GUIRead()-function a little bit so that the return value could be a single- or multiline value.Like in RegRead:When reading a REG_MULTI_SZ key the multiple entries are seperated by @LF - use with StringSplit(..., @LF) to get each entry.I try to test it in the later evening....Regards Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
CyberSlug Posted July 12, 2004 Share Posted July 12, 2004 Use the GuiSendMsg wrappershttp://www.autoitscript.com/fileman/users/public/CyberSlug/GuiMsgWrappers.au3 Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
redndahead Posted July 12, 2004 Author Share Posted July 12, 2004 I tried running this wrapper and I get an error that on line 41 $LB_GETCOUNT is not declared but checking above it looks like you declared it just fine. Any thoughts? red Link to comment Share on other sites More sharing options...
Arctor Posted July 12, 2004 Share Posted July 12, 2004 Hi redndahead, here is just a small example to show how I use the LB_GET...stuff for multiple selects. expandcollapse popup$LBS_EXTENDEDSEL = 0x800 FileChangeDir(@ScriptDir) GUICreate("Title", 220, 300) $listbox1 = GuiSetControl ("list", "", 10,10,200,200,$LBS_EXTENDEDSEL) GUISetControlData($listbox1,"Item1|Item2|Item3|Item4|Item5|Item6") $OK = GUISetControl ("button", "OK", 10,200,100,20) GuiSetControlNotify() ;------------------------------------------------- GuiShow() While GUIMsg() <> -3 $msg = GuiRead() Select case $msg = $OK $LB_GETCOUNT = 0x0000018B $LB_GETSELCOUNT = 0x00000190 $LB_GETSEL = 0x00000187 $LB_GETTEXT = 0x00000189 $n = GUISendMsg($listbox1, $LB_GETCOUNT ,0, 0);count all items $n_sel = GUISendMsg($listbox1, $LB_GETSELCOUNT ,0, 0);count selected items ;----------------------- If $n_sel > 0 Then DIM $arr_sel_names[$n_sel] $i_sel = 0 for $i = 0 to $n-1 $selected = GUISendMsg($listbox1, $LB_GETSEL ,$i, 1);get state of each item IF $selected = 1 Then $arr_sel_names[$i_sel] = GUIRecvMsg($listbox1, $LB_GETTEXT ,$i, 1);if state is 1 (Item selected) get name of item and put into array $i_sel = $i_sel + 1 EndIf Next ;----------------------- ;---Output--------------------- $output = "" For $i = 0 to Ubound($arr_sel_names)-1 $output = $output & $arr_sel_names[$i] & @CRLF Next MsgBox (0, "Selected Items:", $output) EndIf ;------------------------------------------------------------- EndSelect Wend arctor Link to comment Share on other sites More sharing options...
CyberSlug Posted July 13, 2004 Share Posted July 13, 2004 I tried running this wrapper and I get an error that on line 41 $LB_GETCOUNT is not declared but checking above it looks like you declared it just fine. Any thoughts?red What version of AutoIt?At least Arctor's example should work for you if mine doesn't Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
jefhal Posted April 23, 2007 Share Posted April 23, 2007 (edited) Nevermind. I found the UDF documentation at the end of the help file contents. Now working on the ADFunctions ADTools.au3, adapting it to allow me to change multiple users' properties while I'm waiting to upgrade to server 2003 in a year and a half... Jeff Hi Arctor- I tried running your sample code below, but many of the commands seem to be wrong. Is this written in AutoIT3 or is it pseudo code? For example I can't find any of these in the help files: GuiSetControl, GuiSetControlData, GuiShow, GuiSendMsg, GuiRecvMsg.... Can you please translate? Thanks! Hi redndahead, here is just a small example to show how I use the LB_GET...stuff for multiple selects. expandcollapse popup$LBS_EXTENDEDSEL = 0x800 FileChangeDir(@ScriptDir) GUICreate("Title", 220, 300) $listbox1 = GuiSetControl ("list", "", 10,10,200,200,$LBS_EXTENDEDSEL) GUISetControlData($listbox1,"Item1|Item2|Item3|Item4|Item5|Item6") $OK = GUISetControl ("button", "OK", 10,200,100,20) GuiSetControlNotify() ;------------------------------------------------- GuiShow() While GUIMsg() <> -3 $msg = GuiRead() Select case $msg = $OK $LB_GETCOUNT = 0x0000018B $LB_GETSELCOUNT = 0x00000190 $LB_GETSEL = 0x00000187 $LB_GETTEXT = 0x00000189 $n = GUISendMsg($listbox1, $LB_GETCOUNT ,0, 0);count all items $n_sel = GUISendMsg($listbox1, $LB_GETSELCOUNT ,0, 0);count selected items ;----------------------- If $n_sel > 0 Then DIM $arr_sel_names[$n_sel] $i_sel = 0 for $i = 0 to $n-1 $selected = GUISendMsg($listbox1, $LB_GETSEL ,$i, 1);get state of each item IF $selected = 1 Then $arr_sel_names[$i_sel] = GUIRecvMsg($listbox1, $LB_GETTEXT ,$i, 1);if state is 1 (Item selected) get name of item and put into array $i_sel = $i_sel + 1 EndIf Next ;----------------------- ;---Output--------------------- $output = "" For $i = 0 to Ubound($arr_sel_names)-1 $output = $output & $arr_sel_names[$i] & @CRLF Next MsgBox (0, "Selected Items:", $output) EndIf ;------------------------------------------------------------- EndSelect Wend arctor Edited April 24, 2007 by jefhal ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format 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