I moved this post from Beginners section to this one since no one there could offer any help. I've noticed there are more questions related to Data Grid in this section so hopefully someone can answer the following.
I have a display of a number of text lines using a data grid with a checkbox. When displaying the favorites I want them to automatically be refreshed when any of the favorites are disselected.
Right now I can refresh the display by using the 'favorites' button but I would like it to happen without having to click on that button (on the 2nd card).
I tried to put the 'refreshFavorites' command (see the code on the stack level) into the Data Grid Row Behavior button (see the code below) but it does not work.
Code: Select all
on mouseUp pMouseBtnNum --user click
set the itemDel to tab
if pMouseBtnNum = "1" then --left click
if the short name of target() = "BtnCheck" then --do something when checkbox is clicked
SetDataOfLine the dgLine of me,"BtnCheck",the hilite of target() --checkbox t/f
put the dgDataOfLine[the dgHilitedLines of me] of me into TheData --array of line clicked
put TheData["BtnCheck"] into item 2 of line (TheData["Num"]) of gMySelection
refreshFavorites -- DOES NOT WORK!
put TheData["BtnCheck"] into item 2 of line (TheData["Num"]) of gAllLines
set cMySelection of stack gPrefsFile to gMySelection
end if
end if
end mouseUp
Also this does not work:
Code: Select all
on mouseUp pMouseBtnNum --user click
set the itemDel to tab
if pMouseBtnNum = "1" then --left click
if the short name of target() = "BtnCheck" then --do something when checkbox is clicked
SetDataOfLine the dgLine of me,"BtnCheck",the hilite of target() --checkbox t/f
## the lines below do not work!
if text of fld "view" of cd "main" is "Favorites" then
if the hilite of btn "BtnCheck" is false then
refreshFavorites
end if
end if
## the above lines do not work!
put the dgDataOfLine[the dgHilitedLines of me] of me into TheData --array of line clicked
put TheData["BtnCheck"] into item 2 of line (TheData["Num"]) of gMySelection
put TheData["BtnCheck"] into item 2 of line (TheData["Num"]) of gAllLines
set cMySelection of stack gPrefsFile to gMySelection
end if
end if
end mouseUp
How to make it work properly?
To test it in the attached stack, select few quotes as favorites, then click on the button 'favorites' and then disselect some of them.
Thanks in advance for any help.
keram