2015-05-25 58 views
0

如何在數據網格中一個接一個地放置搜索結果。我正在使用下面的代碼。這是行得通的,但它只顯示最後一行(這裏f1是主文本字段,f2是搜索字段,我在「f2」中鍵入一個單詞,如果這個單詞出現在f1中,那麼這行就放在數據網格之後另一個。)如何在datagrid中一個接一個地添加內容

on mouseUp 
    if field "f2" is not empty then 
    put field "f2" into gChar 
    end if 


    local gname 
    put empty into the field "f2" 
    repeat for each line iText in field "f1" 
     if iText contains gChar then 
     put iText after gname 
     set the dgText of group "data" to iText 
    end if 
    end repeat 

    if gname not empty then 

     put gname into the field "f2" 
    end if 

    if field "f2" is empty then 
     put "" into field "f2" 
    end if 

end mouseUp 

回答

相關問題