kon, GEV, thank you both very much for the help. I've looked through the manuals and at least now understand what the code does
Actually, I've combined the methods from both solutions to create a tabbed listboxes
Something like below, looking really good so far, but now I feel I have some excess code which could be trimmed somehow:
Code: Select all
TextItem1 = ; see "Splitting a Long Line into a Series of Shorter Ones" for more info: https://autohotkey.com/docs/Scripts.htm#continuation
(LTrim Join`r`n
Lorem ipsum dolor sit
amet, consectetur
adipiscing elit,
)
TextItem2 =
(LTrim Join`r`n
sed do eiusmod tempor
incididunt ut labore
et dolore magna aliqua.
)
TextItem3 =
(LTrim Join`r`n
Some more text here
Blah blah blah
)
TextItem4 =
(LTrim Join`r`n
Once again
Some more text
)
return
#k::
Gui, Add, Tab2, vMyTabs H250 W200, Subject|Salutation|Text
Gui, Tab, Subject
Gui, Add, ListBox, vChoice1 gItemSelected1 W150 H200, Item1|Item2|Item3|Item4
Gui, Tab, Salutation
Gui, Add, ListBox, vChoice2 gItemSelected2 W150 H200, Item5|Item6|Item7|Item8
Gui, Tab, Text
Gui, Add, ListBox, vChoice3 gItemSelected3 W150 H200, Item9|Item10|Item11|Item12
Gui, Show
return
ItemSelected1:
Gui, Submit
Gui, Destroy
Clipboard := Text%Choice1% ; Copies TextItem1/TextItem2/etc. to the clipboard
TrayTip, Item Copied, %Choice% has been copied to the clipboard.
return
ItemSelected2:
Gui, Submit
Gui, Destroy
Clipboard := Text%Choice2% ; Copies TextItem1/TextItem2/etc. to the clipboard
TrayTip, Item Copied, %Choice% has been copied to the clipboard.
return
ItemSelected3:
Gui, Submit
Gui, Destroy
Clipboard := Text%Choice3% ; Copies TextItem1/TextItem2/etc. to the clipboard
TrayTip, Item Copied, %Choice% has been copied to the clipboard.
return
GuiClose:
Gui, Destroy
return
^Esc::ExitApp ; Ctrl+Escape closes this script
I don't know how to get rid of the many versions of "ItemSelected" function and "Choice" variables, but at least it works!