I have a stack on which there are 3 fields that toggle their colors and their corresponding checkboxes. At the same time the toggling should change the variable (gMyCategories) in order to calculate the correct number of lines and type of categories. The Select All button works OK, but the code for selecting and disselecting each category by toggling the text fields (Short, Medium, Long) does not work - I don't get the correct line numbers and categories in the display fields: "categories" and "Will show". The code is in the group "fldCat" (see the stack)
global gAllLines,gMyCategories
on mouseUp
set the itemDel to tab
put empty into gMyCategories
repeat with j = 1 to the number of fields of grp "fldCat"
if the backgroundcolor of the target is white then
set the hilite of btn (the short name of the target) of grp "CheckCat" to "true"
put the short name of the target & tab after gMyCategories
set the backgroundcolor of the target to yellow
else
set the backgroundcolor of the target to white
set the hilite of btn (the short name of the target) of grp "CheckCat" to "false"
end if
end repeat
delete char -1 of gMyCategories --tab
put gMyCategories into fld "SelCat"
local LinesInMyCategories
repeat for each line i in gAllLines
if item 3 of i is among the items of gMyCategories then put item 1 of i &tab& item 2 of i & tab & item 3 of i &tab& item 4 of i &cr after LinesInMyCategories --lines in selected categories
end repeat
delete char -1 of LinesInMyCategories --return
put the number of lines in LinesInMyCategories into fld "NrOfLines"
put the number of items in gMyCategories into fld "NrOfCategories"
end mouseUp
What do I have to correct? see the stack here: toggle field selection.zip
keram