如何限制弹出窗口中的项目?

How to limit the items in popup?

如何限制弹出窗口中的项目。 "Sar" 数组包含很多单词,关于选择。如果我的第一个弹出窗口包含 15 个项目并进行了更改。转到下一个弹出窗口时,如果它包含 10 个项目,则第一个弹出窗口中剩余的 5 个项目也将添加到第二个弹出选项中。 如何杀死弹出菜单项中的缓冲区?我正在使用此代码

    global jar,myjar,sam,mySam,Dic,Sar
on mouseUp pMouseButton
   put the selectedText of field "MytextField" into Ftext

   if pMouseButton = 3 then

      put the number of lines of (the keys of sam) into mySam
      repeat with i = 1 to mySam 
         if sam[i] contains Ftext then
            put sam[i] into Sar
            split Sar by comma
         end if
      end repeat

      put the text of button "M" into tText
      put the number of words of (the keys of Sar) into mylength
      repeat with x = 1 to mylength 
         put Sar[x] into line x of tText
         end repeat
      put mylength into kk---now iam using this code for delete the buffer
      ----repeat with j = kk to 100
         ---put "" into line j of tText
      ---end repeat
      set the text of button "M" to tText
      popup button "M" at the clickLoc 
   else
      --popup button "M" at the clickLoc
      -- do other stuff here
   end if
end mouseUp

是任何限制弹出项的选项。示例:- 如果弹出窗口包含 15 个项目,我只想看到 10 个项目,剩下的 5 个只能在弹出窗口中单击底部按钮才能看到

您正在使用 globals,这可能不是您想要的。

尝试在添加一些新值之前使用 put empty into Sar 清空全局,或者使用 locals,这将在您的代码完成后清空。