2015-04-21 44 views
0

如何限制彈出窗口中的項目。 「Sar」數組包含很多單詞,就選擇而言。如果我的第一個彈出包含15個項目並做了更改。當進入下一個彈出窗口時,如果它包含10個項目,則剩餘的5個項目也會添加到第二個彈出窗口選項中。 如何殺死彈出菜單項中的緩衝區? Iam使用該代碼如何限制彈出窗口中的項目?

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個可以看到只點擊彈出窗口中的底部按鈕

回答

0

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

嘗試在添加一些新值之前用put empty into Sar清空全局或使用locals,在代碼完成後這些值將被清空。

+0

對不起泰特。它不工作。有沒有任何選項可以從彈出列表中刪除項目?但該刪除的項目不會顯示空白內容。 – Zam

+0

我用這段代碼「刪除tText的第j行」,現在其工作正常 – Zam

+0

很好,感謝您的更新:-) – Tate83

相關問題