PDA

View Full Version : Multi-combobox?


lyvid
10-22-2008, 02:09 PM
I have used autoplay media studio, but not for anything complicated. now I have a need to create a disk for a teacher for state standards. he has all the state standards in a PDF format, but needs to select the state, the subject, then the grade. so I need to be able to select ohio in one combobox (from the list of 50 states), than pick math (from a list of 2 subjects), then 3rd grade (from a list of 7 grades) then the Ohio 3rd grade math standard PDF will start.

I'm pretty sure I can get this to work on different pages, but is there a way to have this on one page?

Is there a better way than using comboboxes?

jassing
10-22-2008, 02:18 PM
On one page, you may have multiple combo boxes.

if the file names are named in a standard way, like:
Ohio-3rd grade-Math.pdf

Then you could be fairly creative and use File.Find() to load up the combo boxes to prevent any typo's.

MSP
10-22-2008, 02:22 PM
Just make 3 combo boxes with all of your information in the Item Text. In the Item data for the given Item Text put in the naming convention of the pdf file. (ex. Ohio3rdMa.pdf meaning Ohio, 3rd grade, Math.) put in the Item data Ohio for the state OH. Then do the same with Item Text is Math and Item data Ma etc. Then on the last combobox in the script On Select use this:


state = ComboBox.GetSelected("ComboBox1"); -- saves the selected item's data
grade = ComboBox.GetSelected("ComboBox2"); -- saves the selected item's data
subject = ComboBox.GetSelected("ComboBox1"); -- saves the selected item's data

result = File.Run("AutoPlay\\Docs\\"..state..""..grade..""subject".pdf", "", "", SW_SHOWNORMAL, false);


Or something like that.

lyvid
10-22-2008, 03:44 PM
I can get it to work if I use the text in the box,

state = ComboBox.GetText("ComboBox1");
grade = ComboBox.GetText("ComboBox2");
subject = ComboBox.GetText("ComboBox3");
File.Open("AutoPlay\\Docs\\"..state..""..grade..""..subject..".pdf", "", SW_SHOWNORMAL);

At least I can get it to work

I'm still working on it, maybe I can get it more the way you suggested. Thanks so much for the help!

jassing
10-22-2008, 03:53 PM
FWIW, you can shorten it down:

File.Open("AutoPlay\\Docs\\"..state..grade..subject..".pdf", "", SW_SHOWNORMAL);

if the state is always 2 characters, and the grade is always 2; then you could use File.Find() to fill in the combo boxes easily...

A slick way to do it would be to use an sqlite database and store all the info -- then fill in the combo boxes based on previous choices...

so they pick OH -- combo box 2 now gets filled with grades with documents for that state, etc. So the user wouldn't be able to pick a document that doesn't actually exist...


But that would require the documents to be named in a standard way, or have delimeters that you could parse...