Guidance
指路人
g.yi.org
Guidance Forums / Rapid-Q Basic / Listbox problem

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

  
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Listbox problem
#831
Posted by: 2003-03-28 23:15:01
My question is: why does ItemIndex =0 not work when I add the items in a Sub as shown in the example below? I have to use a Sub because the data for the listbox are read from file during run time.

Second question: When I press the Cursor Down key then "Choice # 0 Allan" appears in the EditText box. Is it possible to make this shown without a key press at program start?
Help is very much appreciated.

DECLARE SUB ItemClick
DECLARE SUB AddItem
CREATE Form AS QFORM
  CREATE ListBox AS QLISTBOX
               Left = 90
               Top = 20
               ItemIndex = 0 '<- that's the trouble
               Sorted = 1
               OnClick = ItemClick
  END CREATE
  CREATE Edit AS QEDIT
               Left = 90
               Top = 150
  END CREATE
END CREATE
ItemAdd
Form.ShowModal

SUB ItemAdd 
  ListBox.AddItems "Fred", "Ben", "Larry", "Tom",_
  "Will","John","Allan","Charles"
END SUB
SUB ItemClick
  Edit.Text = "Choice # " & STR$ (ListBox.ItemIndex)_
  & "  " & ListBoxItem (Listbox.ItemIndex)
END SUB
Message2. Re: Listbox problem
#832
Posted by: guidance 2003-03-30 10:09:38
Seems you specified itemindex before you itemadd or additem. Could you move itemindex=0 into the sub, just after additems?
Message3. Re: Listbox problem
#833
Posted by: 2003-03-31 16:24:35
Thanks a lot. Now it works.
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
¥1,800.00 ·
 
 
¥489.00 ·
 
 
¥288.00 ·
 
 
¥908.00 ·
 
 
¥748.00 ·
 
 
¥264.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0