The stack that I made should display the text line categories. I can set the Categories on the Select Categories card and the settings are saved in an external text file. When opening the stack again the Categories are correctly displayed in the form but on the card where the selection is made the selected check boxes do not correspond to the displayed Categories.
The code on the stack level that is not working for the above:
global gAllLines,gSelectedCategories
on openStack
put empty into gAllLines
set the itemDelimiter to tab
put fld "alllines" of cd "settingsandfiles" into gAllLines
put empty into gSelectedCategories
set the itemDelimiter to tab -- do I have to set the itemDelimiter here again even though it was set above?
set the defaultFolder to specialFolderPath("Documents")
put URL ("file:./myAppsData.txt") into gSelectedCategories
if "s" is among the items of gSelectedCategories then set the hilite of btn "Short" of cd "select_categories" to true
if "m" is among the items of gSelectedCategories then set the hilite of btn "Medium" of cd "select_categories" to true
if "l" is among the items of gSelectedCategories then set the hilite of btn "Long" of cd "select_categories" to true
end openStack
The code on the Save button on the Select the Categories card is:
global gAllLines,gSelectedCategories,gMyCategories
on mouseUp
put empty into gSelectedCategories
set the itemDelimiter to tab
if the hilite of btn "Short" is true then put "s" & tab after gSelectedCategories
if the hilite of btn "Medium" is true then put "m" & tab after gSelectedCategories
if the hilite of btn "Long" is true then put "l" & tab after gSelectedCategories
put gSelectedCategories into URL ("file:./myAppsData.txt")
go back
end mouseUp
Here is the link to the stack:
https://dl.dropboxusercontent.com/u/99863601/Data%20grid%20Form_save%20and%20retrieve%20settings.zip
or here:
http://filecloud.io/lk06h3py
or here:
http://www.divshare.com/download/24928436-897
the
How to correct this problem?
Thanks in advance.
keram
=======================
I fixed it now by changing the code on the stack level:
on openStack
put empty into gAllLines
set the itemDelimiter to tab
put fld "alllines" of cd "settingsandfiles" into gAllLines
put empty into gSelectedCategories
put URL ("file:" & specialFolderPath("Documents") & "/myAppsData.txt") into gSelectedCategories
if "s" is among the items of gSelectedCategories then set the hilite of btn "Short" of cd "select_categories" to true
else set the hilite of btn "Short" of cd "select_categories" to false
if "m" is among the items of gSelectedCategories then set the hilite of btn "Medium" of cd "select_categories" to true
else set the hilite of btn "Medium" of cd "select_categories" to false
if "l" is among the items of gSelectedCategories then set the hilite of btn "Long" of cd "select_categories" to true
else set the hilite of btn "Long" of cd "select_categories" to false
end openStack
keram