Post Reply 
Multiple Choice for CHOOSE command
08-23-2018, 09:47 PM (This post was last modified: 08-25-2018 07:42 PM by StephenG1CMZ.)
Post: #17
RE: Multiple Choice for CHOOSE command
For comparison, here is my earlier example, re-coded as a callable function.

Code:

 EXPORT MULTICH(CHKLST,TTL,HLP,RSTV,INITV)
 //CHKLST: SELECTABLE LIST
 //TTL:TITLE
 //HLP:HELP
 //RSTV:RESETVALUE
 //INITV:INITVALUE
//as written uses I global
 BEGIN
  LOCAL ST:="{";
  LOCAL LST:=MAKELIST(0,I,1,SIZE(CHKLST));//MAKE LIST FOR RESULTS
  LOCAL OKC;
  //MAKE STRING FOR INPUT
  FOR I FROM 1 TO SIZE(CHKLST) DO
   ST:=ST+"{LST("+I+"),1}";
  END;
  ST:=REPLACE(ST,"}{","},{");//COMMA SEPERATOR
  ST:=ST+"}"; 

  OKC:=EVAL(EXPR("INPUT("+ST+",TTL,CHKLST,HLP,1,1)"));
  IF OKC THEN
   RETURN LST;
  ELSE
   //INPUT CANCELLED
   //MAY WANT TO EMPTY LST?
   RETURN {};
  END;
END;

 EXPORT MCEXAMPLE()
  BEGIN
  //NB ALL AND NONE ARE ORDINARY CHECKBOXES
  LOCAL COMETS:={"ALL","Halley","Lewkowicz","lots more","NONE"};
  LOCAL TTL:="Select Some";
  LOCAL HLP:="Input Help";
  LOCAL RSTV:=1;
  LOCAL INITV:=1;
  MULTICH(COMETS,TTL,HLP,RSTV,INITV);
 END;
 
EXPORT CHOOSER()
BEGIN

END;


Update: The 1,1 should be RSTV,INITV

Perhaps useful, but not as nice as Carlos's visual solution.

Stephen Lewkowicz (G1CMZ)
https://my.numworks.com/python/steveg1cmz
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 - StephenG1CMZ - 08-23-2018 09:47 PM



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