Weather / Spam / www |
Lyon Weather
aldweb against spam
|
|
|
|
|
|
|
- Forum - iziBasic
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 257
Topic # 1014 |
Use of ListChoice |
14/12/2004 @ 13:22 by Mike Featherstone
|
The ListChoice command permits specification of a 'initial selection' string which is displayed by default! whenever the control is invoked. I had assumed that this was intended to provide a default selection (i.e. one of the items from the list) but as it doesn't seem to affect the returned value, I think I must be wrong.
Is the use of this parameter for displaying inital prompts such as 'Select one of the following' rather than seeding an initial result?
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 1 -------- 14/12/2004 @ 23:16 by aldweb
visitor |
Mike,
Yes, the 'initial selection' string is intended to provide a default selection.
Then, I am not sure I understand you exactly. But, let me try to answer anyway and please don't hesitate to ask for more details or to correct my answer.
The default selection is only managed in terms of rendering on the screen. It is up to your source code to store and remember what is the real status of a LISTCHOICE selected item, with the help of the SELECTEDCHOICE function.
The last selection made in a LISTCHOICE is only set for the last LISTCHOICE event (you could have more than one LISTCHOICE in one form) and it has to be captured right away with SELECTEDCHOICE (as explained that quickly in the user manual...).
Here is an example. Let's assume, we have 2 LISTCHOICEs in a form, #1 and #2. Then:
REPEAT E=WAITEVENT IF E=1 LET A=SELECTEDCHOICE : GOSUB _DoSomethingWithIt IF E=2 LET B=SELECTEDCHOICE : GOSUB _DoSomethingWithIt UNTIL E=-1 This is fine, we store in A and B the selected item for each of the 2 LISTCHOICEs.
REPEAT E=DOEVENTs IF E=1 GOSUB _DoSomethingWithIt IF E=2 GOSUB _DoSomethingWithIt UNTIL E=-1
_DoSomethingWithIt: A=SELECTEDCHOICE RETURN
This is not good, A could get the selected item of any the 2 LISTCHOICEs. And we have no way to know which one.
Maybe give a look to the iBAddress sample program shipped with iziBasic. It does handle a LISTCHOICE to sort the different records.
Cheers,
@+ aldweb |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 2 -------- 14/12/2004 @ 23:44 by Mike Featherstone
visitor |
That covers it - I hadn't completely understood the use of SelectedChoice and had expected it to return a value based on the default selection.
Now I understand!
Thanks, Mike |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 3 -------- 15/12/2004 @ 04:11 by Chuck
visitor |
I may be mis-using the LISTCHOICE command, but I have used the initial value to display "Options" as a simulated menu choice at the top of the screen. I then show three other choices when selected and reset the initial value back to "Options" when done. |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 4 -------- 15/12/2004 @ 20:23 by aldweb
visitor |
Mike, I am happy that I answered your request.
Chuck, this is not a mis-use, it is another use which is very common too
@+ aldweb |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 5 -------- 16/12/2004 @ 11:13 by Khertan
visitor |
For your informations, i do the same use of listchoice :) |
|
|
topic active
topic closed
Sticky
New message -
Correct message
Close topic
Make sticky
|
|
|
|
|
|