Post subject: Re: Settings/options menu programming
Posted: Sun Mar 19, 2017 11:05 am
Joined: Sat Feb 11, 2017 1:40 am Posts: 68 Location: France
My way to make Dialog.select multi options.
mSelect Wed Mar 08, 2017 6:51 pm Extension of Dialog.Select, mSelect function displays a select dialog allowing to choose none, one, or more items. Menu items are entered in a N-type list as the second parameter. The N-type list pointed by the first parameter will receive for each item 0 or 1; 1 means selected. Returned value as a function is 0 or 1; 1 means cancelled.
FN.DEF mSelect(#marks,#items, title$) ! define check mark ARRAY.LOAD x$," ","√"
! menu installation LIST.SIZE #items,n nn=n+1 DIM mn$[nn] DIM chk[n] ! local dynamic menu FOR i = 1 to n LIST.GET #items,i,w$ let mn$[i]=" "+w$ NEXT let mn$[nn]="\t\t\t☞ SUBMIT ☜"
! Selection loop WHILE 1 DIALOG.SELECT sel,mn$, title$
! cancelled IF !sel then FN.RTN 1
! Submitted IF sel=nn then W_R.BREAK ! Mark/unmark the item chk[sel]=!chk[sel] let w$=x$ chk[sel]+1] +MID$(mn$[sel],2) let mn$[sel]=w$ REPEAT
! passing result LIST.ADD.ARRAY #marks,chk FN.RTN 0 FN.END
Try mSelect LIST.CREATE S,#items LIST.ADD #items,"a" LIST.ADD #items,"b" LIST.ADD #items,"c" LIST.CREATE N,#marks Abort= mSelect(#marks,#items, "Choose none, one or more")
Users browsing this forum: No registered users and 3 guests
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum