Hello,
I have done a lot of research but I haven't found much. Is this simply not possible? I see a lot for ListView. Would it be easy to switch a ListBox to a ListView if it doesn't work?
Best Answer faqbot , 21 July 2014 - 03:15 PM
Hello,
I have done a lot of research but I haven't found much. Is this simply not possible? I see a lot for ListView. Would it be easy to switch a ListBox to a ListView if it doesn't work?
After a "Gui, Submit command" or with a "GuiControlGet" command.
Si ton labeur est dur et que tes résultats sont minces, souviens toi du grand chêne qui avant n'était qu'un gland....comme toi ! (anonyme)
L'art de lire, c'est l'art de penser avec un peu d'aide. (É. Faguet)
Windows 3.1. Collector's Edition. (www.avaaz.org)
After a "Gui, Submit command" or with a "GuiControlGet" command.
Hi so something like this? So the selected item would go into serialslist?
GUI, Font, s20 cSilver, Arial GUI, Add, Text,,To-Do List: Gui Color, , 4C4C4C GUI, Add, ListBox, w500 h300 vserialslist, %serialslist% GUI, Color, 333333 Gui, Show In another function: Gui, Submit MsgBox %serialslist%
Unless, you are thinking it would be wise to use AltSubmit, get the index returned, then loop until that index?
You can also have an array or a pseudo-array with the different values.
Si ton labeur est dur et que tes résultats sont minces, souviens toi du grand chêne qui avant n'était qu'un gland....comme toi ! (anonyme)
L'art de lire, c'est l'art de penser avec un peu d'aide. (É. Faguet)
Windows 3.1. Collector's Edition. (www.avaaz.org)
You can also have an array or a pseudo-array with the different values.
Is there a way to get the listbox to submit the index to a different variable so I don't destroy the variable that contains the list data?
Yes that should work - there are two methods, where the variable is passed on and one where the index iis passed on try both below to see the difference (comment one of the listbox lines, then the other) [ edited after oldmans good suggestion - variable name]
serialslist=a|b|c|d|e GUI, Font, s20 cSilver, Arial GUI, Add, Text,,To-Do List: Gui Color, , 4C4C4C GUI, Add, ListBox, w500 h300 vSerialnumber, %serialslist% ;GUI, Add, ListBox, w500 h300 vSerialnumber altsubmit, %serialslist% Gui, Add, Button, ,OK GUI, Color, 333333 Gui, Show return ButtonOK: Gui, Submit MsgBox variable (selected) %Serialnumber% Return
Is there a way to get the listbox to submit the index to a different variable so I don't destroy the variable that contains the list data?
It would be better to give another name to the associate output variable (i.e. serialNumber) than serialslist.
GUI, Font, s20 cSilver, Arial GUI, Add, Text,,To-Do List: Gui Color, , 4C4C4C GUI, Add, ListBox, w500 h300 vserialNumber, %serialslist% GUI, Color, 333333 Gui, Show In another function: Gui, Submit MsgBox %serialNumber%
Si ton labeur est dur et que tes résultats sont minces, souviens toi du grand chêne qui avant n'était qu'un gland....comme toi ! (anonyme)
L'art de lire, c'est l'art de penser avec un peu d'aide. (É. Faguet)
Windows 3.1. Collector's Edition. (www.avaaz.org)
Thanks for the replies! Ok so I tried the following but the MsgBox doesn't print a value for serialnumber.
GUI, Font, s20 cSilver, Arial GUI, Add, Text,,To-Do List: Gui Color, , 4C4C4C GUI, Add, ListBox, w500 h300 vserialnumber AltSubmit, %serialslist% GUI, Color, 333333 Gui, Show In another function: GUI, Submit MsgBox variable (selected) %serialnumber%
AltSubmit: Uses alternate submit method. For DropDownList, ComboBox, and ListBox this causes the Gui Submit command to store the position of the selected item rather than its text - see http://ahkscript.org...i.htm#AltSubmit - I take it you do see 1-2-3-4 or 5 in the msgbox so remove altsubmit to get the selected value not the position.
No, I was expecting to see a 1,2,3,4,5,etc but I don't get anything. Also, removing altsubmit didn't fix it either.