OPTION and RADIO conversion to Drop LIST FROM()

I had a window with 7 OPTION controls where we needed to make it smaller so decided to change those to Drop Lists. Instead of the tedious hand conversion I created a small procedure to read the PROPs and generate the LIST FROM() based on the RADIO Text and Value. Just add a Button and call Option2DropList().

Here’s a test Window from the GIST with 4 Options. Below that is the LIST conversion. There was no editting.

The OPTION’s and RADIO’s:

    OPTION('Report Sequence'),AT(3,4,139,26),USE(GLO:PrintRptSequence),BOXED
        RADIO('Employee'),AT(9,15),USE(?PrintContractSequence:Radio1),VALUE('E')
        RADIO('Acct. No.'),AT(55,15,42),USE(?PrintContractSequence:Radio2),VALUE('A')
        RADIO('Dist. Cd.'),AT(98,15,40),USE(?PrintContractSequence:Radio2:2),VALUE('D')
    END
    OPTION('Contract Year'),AT(156,4,101,26),USE(GLO:ContractYearWanted),BOXED
        RADIO('This Year'),AT(160,15,43,10),USE(?ContractYearWanted:Radio1),VALUE('C')
        RADIO('Next Year'),AT(208,15,45,10),USE(?ContractYearWanted:Radio2),VALUE('N')
    END
    OPTION('Contract Status'),AT(275,4,149,26),USE(GLO:ContractStatusWanted),BOXED,TIP('Select "' & |
            'Active" for Automatic and Manual Contracts')
        RADIO('All'),AT(279,15,25,10),USE(?ContractStatus:Radio1)
        RADIO('Active'),AT(303,15,32,10),USE(?ContractStatus:Radio2)
        RADIO('Manual'),AT(338,15,36,10),USE(?ContractStatus:Radio4)
        RADIO('Inactive'),AT(378,15,41,10),USE(?ContractStatus:Radio3)
    END
    OPTION('Contract Expiration'),AT(441,4,131,26),USE(ExpiredStatus),BOXED
        RADIO('Expired'),AT(445,15,37,10),USE(?ExpendedStatus:Radio1),VALUE('E')
        RADIO('Unexpired'),AT(489,15,44,10),USE(?ExpendedStatus:Radio2),VALUE('U')
        RADIO('Both'),AT(541,15,27),USE(?ExpendedStatus:Radio3),VALUE('B')
    END

Code generated for LIST with PROMPT(‘Option text’). The AT() are calculated pretty well. The FROM is built by reading the RADIO Prop:Text and Prop:Value. The #ORDINAL is optional. Get it right and you connect the new LIST to the existing Option Embed code.

!------------------------------------------------------------------------------
!Warning: #Oridinal() set to FEQ. If WRONG you will link to the WRONG Embeds and messs things up !!!
!---------------------------------------------------------------------- FEQ # 2 -----
 PROMPT('Report Sequence'),AT(6,4),USE(?GLO:PRINTRPTSEQUENCE:Prompt),TRN 
 LIST,AT(6,15,54,11),USE(GLO:PRINTRPTSEQUENCE),VSCROLL,DROP(9), |
      FROM('Employee|#E|Acct. No.|#A|Dist. Cd.|#D'), |
   #ORDINAL( 2 )
!---------------------------------------------------------------------- FEQ # 6 -----
 PROMPT('Contract Year'),AT(159,4),USE(?GLO:CONTRACTYEARWANTED:Prompt),TRN 
 LIST,AT(159,15,53,11),USE(GLO:CONTRACTYEARWANTED),VSCROLL,DROP(9), |
      FROM('This Year|#C|Next Year|#N'), |
   #ORDINAL( 6 )
!---------------------------------------------------------------------- FEQ # 9 -----
 PROMPT('Contract Status'),AT(278,4),USE(?GLO:CONTRACTSTATUSWANTED:Prompt),TRN 
 LIST,AT(278,15,49,11),USE(GLO:CONTRACTSTATUSWANTED),VSCROLL,DROP(9), |
      FROM('All|#All|Active|#Active|Manual|#Manual|Inactive|#Inactive'), |
       TIP('Select "Active" for Automatic and Manual Contracts'), |
   #ORDINAL( 9 )
!---------------------------------------------------------------------- FEQ # 14 -----
 PROMPT('Contract Expiration'),AT(444,4),USE(?EXPIREDSTATUS:Prompt),TRN 
 LIST,AT(444,15,52,11),USE(EXPIREDSTATUS),VSCROLL,DROP(9), |
      FROM('Expired|#E|Unexpired|#U|Both|#B'), |
   #ORDINAL( 14 )

I think Option and Radio are easier to use because you can see all choices and pick them easily, but we needed the space. Also having a lot of RADIO’s can look cluttered.

See also: How to make DROP List more visible on the window?

4 Likes

That’s pretty dang neat, Carl. And could be a real time saver.

Sometimes I use a LIST without a DROP. Just depends on the circumstances. Usually takes up less space than an OPTION, but certainly not less than also having a DROP. If it’s a setting that frequently gets touched, it’s kind of nice not to have to do the extra click for the DROP.

e.g., I use this listbox on my imaging app:

image

When I do use OPTION controls, it’s often without the BOXED attribute so that the OPTION portion is not visible. I put a PROMPT to the left, then vertically align the RADIO controls to the right of that. You can fit more stuff on the window that way while looking a little less cluttered with all of those OPTION controls.

Sometimes a droplist is the way to go. Sometimes it isn’t. But I always fret about it.:slight_smile:

1 Like

Thanks Jeff! I agree. Its also nice to see all choices without dropping

My screen only had 2 to 4 choices so the LIST’s would not take much extra space. I added another procedure to the GIST to convert to LIST without DROP. The changes ended up being just the AT( Height ) and no DROP() so could be one procedure.

Generated conversion. I add a VSCROLL just incase, it will not show unless needed.

!---------------------------------------------------------------------- FEQ # 3 -----
 PROMPT('Report Sequence'),AT(6,4),USE(?GLO:PRINTRPTSEQUENCE:Prompt),TRN 
 LIST,AT(6,15,46,26),USE(GLO:PRINTRPTSEQUENCE),VSCROLL, |
      FROM('Employee|#E|Acct. No.|#A|Dist. Cd.|#D')
!---------------------------------------------------------------------- FEQ # 7 -----
 PROMPT('Contract Year'),AT(159,4),USE(?GLO:CONTRACTYEARWANTED:Prompt),TRN 
 LIST,AT(159,15,45,18),USE(GLO:CONTRACTYEARWANTED),VSCROLL, |
      FROM('This Year|#C|Next Year|#N')
!---------------------------------------------------------------------- FEQ # 10 -----
 PROMPT('Contract Status'),AT(278,4),USE(?GLO:CONTRACTSTATUSWANTED:Prompt),TRN 
 LIST,AT(278,15,41,34),USE(GLO:CONTRACTSTATUSWANTED),VSCROLL, |
      FROM('All|#All|Active|#Active|Manual|#Manual|Inactive|#Inactive'), |
       TIP('Select "Active" for Automatic and Manual Contracts')
!---------------------------------------------------------------------- FEQ # 15 -----
 PROMPT('Contract Expiration'),AT(444,4),USE(?EXPIREDSTATUS:Prompt),TRN 
 LIST,AT(444,15,44,26),USE(EXPIREDSTATUS),VSCROLL, |
      FROM('Expired|#E|Unexpired|#U|Both|#B')
2 Likes

Neat-O.

There are all kinds of neat things you can do with a plain old Clarion list control. This is a Color Explorer that I’ll finish some day. https://www.screencast.com/t/rjNx9lrn

2 Likes

Very nice. Felt like I was back at a favorite psychedelic rock show. :star_struck:

It makes more sense when you’re the one in the driver seat, otherwise it seems random. Everything you click on changes the color. Then the HSL/RGB controls change to show you the new choices and their impact on the next color. There are quite a few HTML color pickers that do the same kind of thing. https://www.w3schools.com/colors/colors_picker.asp

What fun is that? Happy to be a passenger at times.