Guidance
指路人
g.yi.org
software / rapidq / examples / gui / listbox & ComboBox / Delete by Item.bas

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
'From: "Alan Jones" <aej@tesco.net> Wed, 31 Jul 2002 22:25:20 +0100

' Re: [rapidq] How to get index of item in ListBox?

'>There're 'apple', 'orange' and 'lemon' in a listbox. We
'>don't know their indexes and want to delete
'>'orange'.
'>Orange is _not_ selected.
'>Just like function for Delphi
'ListBox.Items.IndexOf(string):Integ

'This code use listbox.text to manipulate all items, since they're just
'CRLF separated and William didn't offer IndexOf method for QListBox:

     DECLARE SUB Remove

     CONST CRLF = CHR$(13) + CHR$(10)

     CREATE Form AS QFORM
      CREATE ListBox AS QLISTBOX
       Align = 1
       AddItems "apple", "orange", "lemon"
      END CREATE
      CREATE Button AS QBUTTON
       Align = 2
       CAPTION = "Remove 'orange'"
       OnClick = Remove
      END CREATE
      Center
      SHOWMODAL
     END CREATE

     SUB Remove
      ListBox.Text = REPLACESUBSTR$(ListBox.Text, _
       CRLF + "orange" + CRLF, CRLF)

     END SUB
掌柜推荐
 
 
¥918.00 ·
 
 
¥738.00 ·
 
 
¥1,580.00 ·
 
 
¥920.00 ·
 
 
¥296.00 ·
 
 
¥890.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2002-08-01 06:47:50