File, variable, array, split

yves COPPE yvescoppe at skynet.be
Thu Sep 26 12:05:00 EDT 2002


>>My code is currently this:
>>
>>on openstack
>>   put url "file:translations" into tTranslations
>>   split tTranslations with cr and tab
>>   set the customProperties[cTranslations] of this stack to tTranslations
>>   put url "file:forms" into tForms
>>   split tForms with cr and tab
>>   set the customProperties[cForms] of this stack to tForms
>>end openstack
>>
>>on mouseUp
>>   select the clickText
>>   put the clickText into tClickedWord
>>   put the cForms[tClickedWord] of this stack into fld "Translation Display"
>>   put "  " after fld "Translation Display"
>>   put the cTranslations[tClickedWord] of this stack after fld "Translation
>>Display"
>>   set the textStyle of word 1 of fld "Translation Display" to bold
>>   set the textStyle of word 2 of fld "Translation Display" to italic
>>end mouseUp
>>
>>But for this, I still need external data files in the standalone app.  What
>>should I change in the above code to have the data stored in the
>>application?
>
>


it depends what's your goal.
if your list is definitively closed, you don't have to load it at 
each "openstack".
this code can be deleted.

if your list can be changed

either : you write an external text file with and you load the text 
file in your custom properties as you do in your open stack code

either you script a menu that adds words directly in your custom property.
Don't forget to save your stack at each "close stack" because a 
custom property MUST be saved (not as a fld)

to add a word to your array you can

either use the number of keys of your array and then add one array 
after the last record

either
use the combine command
  put the customProperties["the Name of Your Array"] of this stack into tx
   combine tx using cr and tab
then when you have a text you can handle it as you want and then 
re-create your array as above.


hope this help.
-- 
Greetings.

Yves COPPE

Email : yvescoppe at skynet.be



More information about the Use-livecode mailing list