Adam
11-07-2007, 03:15 PM
Question
How do I make a ComboBox object hold a list of file and open the selected file?
Answer
The best way to make a comboBox object hold a list of files and open the selected one at runtime is:
1) In the ComboBox settings give each entry an appropriate display name under the section Item Text
2) In the ComboBox settings give each entry a link to a file located in the docs folder. An example would be AutoPlay\\Docs\\MyPDF.pdf
3) In the Script -> On Select tab you could then use this generic script:
-- Get the selected index
selected = ComboBox.GetSelected("ComboBox1");
-- Get the data (file path) of that entry
data = ComboBox.GetItemData("ComboBox1", selected);
-- Open the file
File.Open(data, "", SW_SHOWNORMAL);
How do I make a ComboBox object hold a list of file and open the selected file?
Answer
The best way to make a comboBox object hold a list of files and open the selected one at runtime is:
1) In the ComboBox settings give each entry an appropriate display name under the section Item Text
2) In the ComboBox settings give each entry a link to a file located in the docs folder. An example would be AutoPlay\\Docs\\MyPDF.pdf
3) In the Script -> On Select tab you could then use this generic script:
-- Get the selected index
selected = ComboBox.GetSelected("ComboBox1");
-- Get the data (file path) of that entry
data = ComboBox.GetItemData("ComboBox1", selected);
-- Open the file
File.Open(data, "", SW_SHOWNORMAL);