Стек, который я сделал, должен отображать категории текстовых строк. Я могу установить категории на карточке «Выбрать категории», и настройки будут сохранены во внешнем текстовом файле. При повторном открытии стека Категории правильно отображаются в форме, но на карточке, где производится выбор, установленные флажки не соответствуют отображаемым Категории.
Код на уровне стека, который не работает для вышеуказанного:
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
Код кнопки «Сохранить» на карточке «Выбрать категории»:
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
Вот ссылка на стек:
https://dl.dropboxusercontent.com/u/99863601/Data%20grid%20Form_save%20and%20retrieve%20settings.zip
или здесь:
http://filecloud.io/lk06h3py
или здесь:
http://www.divshare.com/download/24928436-897 а>
в
Как исправить эту проблему?
Заранее спасибо.
керам
=======================
Я исправил это сейчас, изменив код на уровне стека:
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
керам