Guidance Forums / Rapid-Q Basic / Forcing QListBox item selections; is it possible?

Search 搜索
Home Home

Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Forcing QListBox item selections; is it possible?
Posted by: Nova_Shard 2004-07-28 04:57:19
Hey there, Groovy Coders!

   I'm new to the wonderful world of Rapid-Q programming, and I have a very basic question for you guys.  What I'm trying to do is make the program highlight/select specific lines of text in a QListBox field.  My ultimate goal is to allow the user to click on a single line in the ListBox, and then have the program respond by highlighting several associated lines above and below it.  From that point, a command such as deletion of those lines could be used.  What I need to know is, can that be done?  Is there a command in Rapid-Q that will allow me to highlight a specific line in the ListBox field (as identified by it's index number, or some such)?

   Any help is greatly appreciated.  Thanks.
Message2. Re: Forcing QListBox item selections; is it possible?
Posted by: 2004-07-28 11:36:15
To select a QListBox item use ItemIndex with the number of the item you want (mind you, it starts counting at 0). This will select ONE item only, it is not possible to highlight more than one item.

From the documentation;

 ListBox.AddItems "1. Apples", "2. Oranges", "3. Bananas"

 ListBox.DelItems 1,2       '' Deletes Oranges and Bananas

 ListBox.Item(0) = "1. Strawberries"   '-- Change the first item
What you can do is use a QButton with a command behind it that deletes the selected listbox item (something like

 nr = ListBox.ItemIndex
 ListBox.DelItems nr
Message3. Re: Forcing QListBox item selections; is it possible?
Posted by: Nova_Shard 2004-07-29 04:13:29
   Thanks for the suggestions, Baardaap.  Those definately gave me some ideas to work with.  While exploring the documentation, I noticed that a user's ability to highlight multiple lines in a QListBox (by SHIFT + arrow) is disabled by default, but can be re-enabled by using the following command.

ListBox.MultiSelect = True

   Using this method, I can now manually highlight multiple lines in the QListBox using keyboard input while the program is running (SHIFT + arrow). It occurs to me that the program must have some way to keep track of which lines are being highlighted and which are not.  What I would like to do is have the program prompt for such an indicator, so that the code can find out which are being highlighted in  a multiselect situation, and potentially allow it to create such highlighted selections on the screen without the user having to physically click on a line.

   The documentation on Rapid-Q is truly superior in many regards, but in some ways it's left a bit lacking.  Commands for QListBox such as Tag and SelCount are pretty much a mystery as far as the Appendix documentation is concerned.  They sound like they might help out in this situation, but even their syntax for proper execution becomes a guessing game.  Any insight on this guys?  Is there a command or value that can tell you which lines are currently highlighted in a MultiSelect situation?  And if so, can it be used to make the code create multiple highlighted lines without action by the user?  If the user can highlight multiple lines using keyboard input, then the program must be able to recreate that action by some means.
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
© Fri 2017-9-22  Guidance Laboratory Inc. Hits:0