Post Reply 
Multiple Choice for CHOOSE command
08-09-2018, 08:35 AM (This post was last modified: 08-09-2018 08:46 AM by Carlos295pz.)
Post: #3
RE: Multiple Choice for CHOOSE command
Another more visual alternative

Code:
GENLIST(List,Chosen)
BEGIN
  FOR X:=1 TO SIZE(List) DO
    List(X):=IFTE(POS(Chosen,X),"● ","○ ")+List(X)
  END
END;

EXPORT CHOSEN
BEGIN

  LOCAL List={"vanilla","strawberry","coffee","coconut","chocolate"};
  LOCAL X,SList={};

  WHILE CHOOSE(X,"Chosen ("+SIZE(SList)+")",GENLIST(List,SList)) DO
    SList:=IFTE(POS(SList,X),DIFFERENCE(SList,X),UNION(SList,X))
  END;

  L1:=List;
  MSGBOX(EXECON("L1(&1)",SList))
END;

It is possible to add the exit option without problems

Viga C | TD | FB
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Multiple Choice for CHOOSE command - Carlos295pz - 08-09-2018 08:35 AM



User(s) browsing this thread: 2 Guest(s)