I need to be able to double click an item in one Listbox and it transfer to an empty Listbox adjacent to; I am attempting to set up a system where you can pick items from List 1, the selected items populate into list, and eventually export to quote template in Excel.
Also.. If possible, I would like to figure out a way to have the original list numbered, but when transferred to the second list, unnumbered.
Any help on these matters would be greatly appreciated!
Listbox to Listbox item transfer? Topic is solved
Re: Listbox to Listbox item transfer? Topic is solved
I'm not sure what you meant by numbering so you may need to tweak it a little
Code: Select all
list1 := ["item1","item2","item3","item9999"]
list2 := []
Gui,Add,Listbox,x5 y5 w150 h250 vlb1 gaddItem, % arrayToString(list1,1)
Gui,Add,Listbox,x170 y5 w150 h250 vlb2, % arrayToString(list2)
Gui,Show,,Listbox Example
return
addItem:
gui,submit,nohide
list2.insert(RegExReplace(lb1,"^\d+\.\s","")) ;add list1 item to list2, replace the number if its present (^=beginning, \d+=numbers until not number,\.=literal dot,\s=space)
guicontrol,,lb2,| ;clear listbox
guicontrol,,lb2, % arrayToString(list2)
return
arrayToString(a,numbered=0) { ;convert array elements into listbox string
s := ""
loop % a.length() {
s .= (a_index > 1 ? "|" : "") (numbered ? a_index ". " : "") a[a_index]
}
return s
}
Some of my AHK programs: 3D Voxel Game - Platformer Game
GitHub projects : Image/Pixel scanning class - Direct2D overlay class
GitHub projects : Image/Pixel scanning class - Direct2D overlay class
Re: Listbox to Listbox item transfer?
Hey! Thanks a lot, this worked for the list to list transfer, so there is one big hurdle out of the way, I really appreciate it!
Edit: I forgot to mention that after a slight tweak, this also fixed the issue with the list numbering issue. Thanks again!
Edit: I forgot to mention that after a slight tweak, this also fixed the issue with the list numbering issue. Thanks again!
Who is online
Users browsing this forum: filipemb, Ineedhelplz, mapcarter, peter_ahk, Rohwedder and 314 guests