|
Prev: ComboBox Inquiry
Next: Shockwave 11 Active X Crash
From: roy16 on 29 Mar 2008 06:55 :mad; I need to do a form for delivery order. Just fill some personal data and order of product. Inside I have some combo box of product, but I need save the record into txt file (just once time) then need to retrieve the data from txt file onto combo box. I have attached the code, I don't know which part got wrong, anybody who get help me? Combo box code : controls := wcGetControlList() listing := "Choose an Item"^Return^"Hot Chocholate"^Return^"Tea"^Return^"Coffee"^Return^"Low fat Milk"^Return^"Full Cream Milk"^Return^"Orange Juice"^Return^"Purified Water" id_list := wcDisplayControl(350, 350, 150, 21, "ComboBox", "wcS") propList := wcGetPropertyList(id_list) Save the data from Combo box list : data := wcGetPropertyValue(id_list, "value")^Return WriteExtFile("list2.txt", data) Read the data from txt : data := ReadExtFile("list2.txt") Convert string to list : id_list := [:] AddProperty(data^id_list,controls ,GetLine(data,1))
From: Amy Blankenship on 29 Mar 2008 12:12 "roy16" <webforumsuser(a)macromedia.com> wrote in message news:fsl776$hqq$1(a)forums.macromedia.com... > :mad; I need to do a form for delivery order. Just fill some personal data > and > order of product. Inside I have some combo box of product, but I need > save the > record into txt file (just once time) then need to retrieve the data from > txt > file onto combo box. I have attached the code, I don't know which part got > wrong, anybody who get help me? > > Combo box code : > controls := wcGetControlList() > listing := "Choose an Item"^Return^"Hot > Chocholate"^Return^"Tea"^Return^"Coffee"^Return^"Low fat > Milk"^Return^"Full > Cream Milk"^Return^"Orange Juice"^Return^"Purified Water" > id_list := wcDisplayControl(350, 350, 150, 21, "ComboBox", "wcS") > propList := wcGetPropertyList(id_list) > > > Save the data from Combo box list : > data := wcGetPropertyValue(id_list, "value")^Return data at this point will be some number between 0 and 7 and your appended return. > WriteExtFile("list2.txt", data) > > Read the data from txt : > data := ReadExtFile("list2.txt") This will again be a string that contains a number and a return. > Convert string to list : > id_list := [:] Before, you are populating id_list with a single number that is the _ID_ of the winCtrl . Now, you are changing it to an empty property list. Why? > AddProperty(data^id_list,controls ,GetLine(data,1)) The first parameter of AddProperty is supposed to be the name of a variable which is a property list. As such, you couldn't use a concatenated expression there. Even if you could, an Authorware variable cannot begin with a number, which data always will in this instance. It also cannot contain a return. _And_ the characters "[:]" are not valid parts of a variable name either. Next, you're trying to add a property that looks something like: "Button\rCheckBox\rCheckListBox\rColorCombo\rComboBox\rDriveCombo\rEdit..." While a property list _can_ have strings instead of symbols as the keys to the values, this is not documented or officially supported. Even if it were, you _cannot_ have a key with returns in it, and I have no idea why you'd want to! Here are the steps you should be using: 1) Create your WinCtrl and store its ID in a regular numeric value (I'll call it wcID for convenience) 2) Set its Items property to listing. 3) Check for the existence (FileType) of your file with the value of the winCtrl in it. If it exists, set the value property of wcID to the contents of the file. 4) You're using wcS as your change event, so set up a conditional on false to true with wcS as the condition. 5) Inside that response, write the "value" property (without the return) of the wcID control to file. HTH; Amy
|
Pages: 1 Prev: ComboBox Inquiry Next: Shockwave 11 Active X Crash |