Spécial ! |
Version mobile de l'aldweb Site m.aldweb.com Ni Français, ni Anglais ?Essayez donc l'un de ces drapeaux :
|
|
Météo / Spam / www |
Météo Lyon
aldweb contre le SPAM
|
|
|
|
|
|
|
- Forum - iziBasic
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 257
Sujet n° 1014 |
Use of ListChoice |
le 14/12/2004 @ 13:22 par 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
Réponse n° 1 -------- le 14/12/2004 @ 23:16 par aldweb
visiteur |
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
Réponse n° 2 -------- le 14/12/2004 @ 23:44 par Mike Featherstone
visiteur |
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
Réponse n° 3 -------- le 15/12/2004 @ 04:11 par Chuck
visiteur |
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
Réponse n° 4 -------- le 15/12/2004 @ 20:23 par aldweb
visiteur |
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
Réponse n° 5 -------- le 16/12/2004 @ 11:13 par Khertan
visiteur |
For your informations, i do the same use of listchoice :) |
|
|
sujet actif
sujet clos
Important!
Nouveau message -
Rectifier message
Clôturer sujet
Remonter
|
|
|
|
|
|