我使用带有复选框的数据网格显示了许多文本行。当显示收藏夹时,我希望它们在任何收藏夹被分割时自动刷新。 现在我可以使用“收藏夹”按钮刷新显示,但我希望它不需要点击那个按钮(在第二张卡片上)就可以了。
我尝试将'refreshFavorites'命令(请参阅堆栈级别的代码)放入数据网格行行为按钮(请参阅下面的代码),但它不起作用。
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
这也行不通:
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
如何使其正常工作?
可以下载堆栈here
要测试它,选择几行作为收藏夹,然后点击“收藏夹”按钮,然后分析其中一些。
答案 0 :(得分:0)
我已经让它工作正常了,感谢TerryL在LC论坛
创建了另一个命令,deleteFavorites与除了1行之外的refreshFavorites相同:回答“抱歉,但你必须至少选择...”并且我已将新命令放入数据网格的行行为中:
on mouseUp pMouseBtnNum --user click
......
if the text of fld "view" = "Favorites" then send "deleteFavorites" to this stack in 0 secs --delete unchecked
end if