Skip to content

Instantly share code, notes, and snippets.

@CarlTBarnes
Last active April 30, 2021 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CarlTBarnes/e73b02cee9c2d5b73eab8a35e841f618 to your computer and use it in GitHub Desktop.
Save CarlTBarnes/e73b02cee9c2d5b73eab8a35e841f618 to your computer and use it in GitHub Desktop.
Replace OPTION with LIST,DROP - find all OPTION controls on a Window and generate a LIST,DROP() with FROM('Text#Value') as the RADIO('Text'),Value('valuie') plus PROMPT
! Version 2 - DROP and No DROP in one procedure. FORMAT() and ~Header option
! Generate LIST,DROP,FROM() reading OPTION and RADIOs -- or LIST without DROP
! Option + Radio's take mnore space that a LIST,DROP,FROM('radio|radio|radio')
! The Option can be easier for the User and more obvious of all the choices without dropping
! Some times you don't have the space, or too many Options can be visual clutter
!
PROGRAM
MAP
Option2DropList PROCEDURE() !Add this to your program and a button on the Window to call it,
MODULE('RTL') !Global MAP Requires this
ClaFieldNameRTL(LONG pFEQ),CSTRING,RAW,NAME('Cla$FIELDNAME'),DLL(dll_mode)
END
TEST_Option2List PROCEDURE()
END
CODE
TEST_Option2List()
!=========================================================================================
! For all OPTIONs on a Window generate LIST Code with FROM() being the RADIOs
! Add this Procedure to the APP, and ClaFieldNameRTL to the MAP
! On the Window add a Button that calls Option2DropList()
!-------------------------------------------------------------------------------
! If Radio's have Embed code in Event:Selected that needs to be moved to the LIST Accepted. Or before conversion you can move the code to the OPTION Accepted and test it.
! If Radio's do not have a VALUE() and use the Number of the Radio that will need to be changed in the FROM() to have # Radio Number, or handled other ways.
! When you paste in the LIST set the #ORDINAL() to that of the OPTION so the Embed code is linked.
! When done check for Embed Orphans
!-------------------------------------------------------------------------------
Option2DropList PROCEDURE()
! MODULE('RTL') !MAP Requires this
! ClaFieldNameRTL(LONG pFEQ),CSTRING,RAW,NAME('Cla$FIELDNAME'),DLL(dll_mode)
! END
CodeGen ANY
OptFEQ LONG
UseVar CSTRING(80),AUTO
OrdinalGen BOOL(1),STATIC
OrdinalFEQ BOOL(0),STATIC
IsDrop BOOL(1),STATIC
FormatIt BOOL(1),STATIC
FormatHead BOOL(0),STATIC
Window WINDOW('Option 2 List'),AT(,,287,149),GRAY,SYSTEM,FONT('Segoe UI',9)
CHECK('DROP type LIST - uncheck for multi-line LIST'),AT(5,6),USE(IsDrop)
CHECK('FORMAT() on LIST - margins make easier to read'),AT(5,22),USE(FormatIt)
CHECK('~Header~ in FORMAT() with Prompt Text'),AT(15,34),USE(FormatHead)
CHECK('#ORDINAL() in the generated code'),AT(5,52),USE(OrdinalGen)
CHECK('Set ORDINAL as FEQ - Warning: they change as you add/delete controls'),AT(14,64),USE(OrdinalFEQ)
STRING('Fill in #ORDINAL with the OPTION''s #ORDINAL( # ) to link the Embeds'),AT(5,78),USE(?WarnOrd1)
STRING('Do NOT get #ORDINAL wrong or you link to wrong embed code and mess things up'),AT(5,89),USE(?WarnOrd2)
BUTTON('&Generate'),AT(97,109,41,19),USE(?OkBtn)
BUTTON('&Cancel'),AT(149,109,41,19),USE(?CancelBtn),STD(STD:Close)
END
CODE
OPEN(Window)
ACCEPT
CASE ACCEPTED()
OF ?OkBtn ; OptFEQ=1 ; BREAK
END
END
CLOSE(Window)
IF ~OptFEQ THEN RETURN.
LOOP OptFEQ=FIRSTFIELD() TO LASTFIELD() !This is in FEQ Order vs PROP:NextField is odd order
IF OptFEQ{PROP:Type} <> Create:Option THEN CYCLE.
UseVar=ClaFieldNameRTL(OptFEQ)
IF ~UseVar then UseVar='UseFeq#' & OptFEQ. !Should not happen
IF UseVar[1]='?' then !Always get ?Var
UseVar=SUB(UseVar,2,LEN(UseVar)-1) !Assume we have USE(Var)
END
DO Gen1OptionRtn
END
IF OrdinalFEQ THEN
CodeGen ='!Warning: #Oridinal() set to FEQ. If WRONG you will link to the WRONG Embeds and messs things up !!!' & |
'<13,10>' & CodeGen
END
SETCLIPBOARD(CodeGen)
Message('Option 2 LIST Code is on the Clipboard','Option2List')
RETURN
!--------------------
Gen1OptionRtn ROUTINE
DATA
PromptText PSTRING(256)
Prompt1 ANY
Format1 PSTRING(256)
List1 ANY
From1 ANY
RadCount LONG
RadioFEQ LONG
ValueRad PSTRING(256)
Width1 LONG
WidthMax LONG
XPosOpt LONG
YPosOpt LONG
ListWidth LONG
ListHeight LONG
CommaPipeCRLF EQUATE(', |<13,10> {6}')
CODE
GETPOSITION(OptFEQ,XPosOpt,YPosOpt)
PromptText=QUOTE(OptFEQ{PROP:Text})
IF ~CLIP(PromptText) THEN PromptText='Option ' & UseVar. !OPTION,AT() without title
IF PromptText THEN
Prompt1 = ' PROMPT(''' & PromptText & ''')' & |
',AT(' & XPosOpt+3 &','& YPosOpt &')' & | !XPos of Option is Box so +3
',USE(?' & CLIP(UseVar) &':Prompt),TRN <13,10>'
END
WidthMax=20
LOOP RadCount=1 TO 99
RadioFEQ=OptFEQ{PROP:Child,RadCount}
IF ~RadioFEQ THEN BREAK.
ValueRad=RadioFEQ{PROP:Value}
IF ~ValueRad THEN ValueRad=RadCount. !No value then Radio is Index Number
IF RadCount > 1 THEN From1=From1 & '|'.
From1=From1 & QUOTE(RadioFEQ{PROP:Text}) | !|Description
& '|#' & QUOTE(ValueRad) !|#value
Width1=RadioFEQ{PROP:Width} !Use Widest Radio to size LIST width
IF Width1 AND WidthMax < Width1 THEN WidthMax = Width1.
END
RadCount -= 1
IF IsDrop THEN
ListWidth = WidthMax + 8 !The drop button is 12 but Radio width includes Radio Icon
ListHeight= 11
IF RadCount < 9 THEN RadCount=9 ELSE RadCount += 5. !use DROP(9) if < 9
ELSE !No Drop
ListWidth = WidthMax + 0 !Radio width includes Radio Icon about 10
ListHeight= 2 + 8 * RadCount
IF FormatIt AND FormatHead THEN ListHeight += 9.
END
IF FormatIt THEN
Format1=CommaPipeCRLF &'FORMAT(''' & |
'999L(2)' & |
CHOOSE(~FormatHead,'','~'& PromptText &'~') & |
'@s255@'')'
END
List1=' LIST' & |
',AT('& XPosOpt+3 &','& YPosOpt+11 &','& ListWidth &','& ListHeight &')'& | !AT(X,Y,W,H)
',USE(' & CLIP(UseVar) &')' & |
',VSCROLL' & |
CHOOSE(~IsDrop,'',',DROP(' & RadCount & ')') & |
Format1 & |
CommaPipeCRLF &'FROM(''' & From1 & ''')'
IF OptFEQ{PROP:Tip} THEN
List1=List1 &CommaPipeCRLF &'TIP(''' & QUOTE(CLIP(OptFEQ{PROP:Tip})) &''')'
END
IF OrdinalGen THEN
List1=List1 & CommaPipeCRLF & |
CHOOSE(~OrdinalFEQ,'#ORDINAL( )','#ORDINAL( ' & OptFEQ &' )')
END
CodeGen = CodeGen & '!-{70} FEQ # ' & OptFEQ &' -----' & |
'<13,10>' & Prompt1 & | !Has <13,10> if not blank
List1 & '<13,10>'
EXIT
!#############################################################################################
!#############################################################################################
!################################# Test Option2DropList ###################################
TEST_Option2List PROCEDURE()
GLO:PrintRptSequence STRING(1)
GLO:ContractYearWanted STRING(1)
GLO:ContractStatusWanted STRING(8)
ExpiredStatus STRING(1)
ClipCode STRING(6000)
Window WINDOW('Option2List Test - Version 2'),AT(,,579,250),GRAY,SYSTEM,FONT('Segoe UI',9),RESIZE
BUTTON('Option 2 Drop List or No Drop'),AT(30,46),USE(?OP2ListDropBtn)
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 Automati' & |
'c 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
BUTTON('Cl&ose'),AT(160,46,86),USE(?CloseBtn),STD(STD:Close)
TEXT,AT(2,69),FULL,USE(ClipCode),HVSCROLL,FONT('Consolas',10)
END
CODE
OPEN(Window)
ACCEPT
CASE Accepted()
OF ?OP2ListDropBtn
SETCLIPBOARD('??')
Option2DropList()
ClipCode=CLIPBOARD() ; DISPLAY
END
END
!#############################################################################################
!#############################################################################################
OMIT('!**End Test Window 1**')
Paste_Test_Window1_Here routine
DATA
DropListTest WINDOW('Option2DropList Test'),AT(,,579,154),GRAY,SYSTEM,FONT('Segoe UI',9)
! ===== Paste Option2DropList code below to open in Designer and Preview =====
!---------------------------------------------------------------------- FEQ # 2 -----
!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 )
END
!end of OMIT('!**End Test Window 1**')
OMIT('!**End Test Window 2**')
Paste_Test_Window1_Here routine
DATA
ListTest WINDOW('Option2List without DROP Test'),AT(,,579,154),GRAY,SYSTEM,FONT('Segoe UI',9)
! ====== Paste Option2List code below to open in Designer and Preview ======
!---------------------------------------------------------------------- FEQ # 2 -----
PROMPT('Report Sequence'),AT(6,4),USE(?GLO:PRINTRPTSEQUENCE:Prompt),TRN
LIST,AT(6,15,46,35),USE(GLO:PRINTRPTSEQUENCE),VSCROLL, |
FORMAT('999L(2)~Report Sequence~@s255@'), |
FROM('Employee|#E|Acct. No.|#A|Dist. Cd.|#D')
!---------------------------------------------------------------------- FEQ # 6 -----
PROMPT('Contract Year'),AT(159,4),USE(?GLO:CONTRACTYEARWANTED:Prompt),TRN
LIST,AT(159,15,45,27),USE(GLO:CONTRACTYEARWANTED),VSCROLL, |
FORMAT('999L(2)~Contract Year~@s255@'), |
FROM('This Year|#C|Next Year|#N')
!---------------------------------------------------------------------- FEQ # 9 -----
PROMPT('Contract Status'),AT(278,4),USE(?GLO:CONTRACTSTATUSWANTED:Prompt),TRN
LIST,AT(278,15,41,43),USE(GLO:CONTRACTSTATUSWANTED),VSCROLL, |
FORMAT('999L(2)~Contract Status~@s255@'), |
FROM('All|#All|Active|#Active|Manual|#Manual|Inactive|#Inactive'), |
TIP('Select "Active" for Automatic and Manual Contracts')
!---------------------------------------------------------------------- FEQ # 14 -----
PROMPT('Contract Expiration'),AT(444,4),USE(?EXPIREDSTATUS:Prompt),TRN
LIST,AT(444,15,44,35),USE(EXPIREDSTATUS),VSCROLL, |
FORMAT('999L(2)~Contract Expiration~@s255@'), |
FROM('Expired|#E|Unexpired|#U|Both|#B')
END
!end of OMIT('!**End Test Window 2**')
! Version 1 wth separate DROP and No Drop LIST code
! Generate LIST,DROP,FROM() reading OPTION and RADIOs -- or LIST without DROP
! Option + Radio's take mnore space that a LIST,DROP,FROM('radio|radio|radio')
! The Option can be easier for the User and more obvious of all the choices without dropping
! Some times you don't have the space, or too many Options can be visual clutter
!
PROGRAM
MAP
Option2DropList PROCEDURE() !Add this to your program and a button on the Window to call it,
Option2List PROCEDURE() !Generate LIST without DROP()
MODULE('RTL') !Global MAP Requires this
ClaFieldNameRTL(LONG pFEQ),CSTRING,RAW,NAME('Cla$FIELDNAME'),DLL(dll_mode)
END
TEST_Option2List PROCEDURE()
END
CODE
TEST_Option2List()
!=========================================================================================
! For all OPTIONs on a Window generate LIST Code with FROM() being the RADIOs
! Add this Procedure to the APP, and ClaFieldNameRTL to the MAP
! On the Window add a Button that calls Option2DropList()
!-------------------------------------------------------------------------------
! If Radio's have Embed code in Event:Selected that needs to be moved to the LIST Accepted. Or before conversion you can move the code to the OPTION Accepted and test it.
! If Radio's do not have a VALUE() and use the Number of the Radio that will need to be changed in the FROM() to have # Radio Number, or handled other ways.
! When you paste in the LIST set the #ORDINAL() to that of the OPTION so the Embed code is linked.
! When done check for Embed Orphans
!-------------------------------------------------------------------------------
Option2DropList PROCEDURE()
! MODULE('RTL') !MAP Requires this
! ClaFieldNameRTL(LONG pFEQ),CSTRING,RAW,NAME('Cla$FIELDNAME'),DLL(dll_mode)
! END
CodeGen ANY
OptFEQ LONG
UseVar CSTRING(80)
OrdinalType LONG
CODE
OrdinalType = Message('Include #ORDINAL() in the generated code? ' & |
'||If filled in with the #ORDINAL( # ) of the OPTION it will link the Embeds.' & |
'||ORDINAL should be the FEQ. Warning: they will change as you delete RADIOs.', |
'Option 2 Drop List',ICON:Question, |
'NO Ordinal()|#ORDINAL( )|#ORDINAL( FEQ )')
LOOP OptFEQ=FIRSTFIELD() TO LASTFIELD() !This is in FEQ Order vs PROP:NextField is odd order
IF OptFEQ{PROP:Type} <> Create:Option THEN CYCLE.
UseVar=ClaFieldNameRTL(OptFEQ)
IF ~UseVar then UseVar='feq#' & OptFEQ. !Should not happen
IF UseVar[1]='?' then !Always get ?Var
UseVar=SUB(UseVar,2,LEN(UseVar)-1) !Assume we have USE(Var)
END
DO Gen1OptionRtn
END
IF OrdinalType=3 THEN
CodeGen ='!Warning: #Oridinal() set to FEQ. If WRONG you will link to the WRONG Embeds and messs things up !!!' & |
'<13,10>' & CodeGen
END
SETCLIPBOARD(CodeGen)
Message('Option 2 Drop LIST Code is on the Clipboard','Option2DropList')
RETURN
!--------------------
Gen1OptionRtn ROUTINE
DATA
Prompt1 PSTRING(256)
OrdinalCode PSTRING(256)
List1 ANY
From1 ANY
RadCount LONG
RadioFEQ LONG
ValueRad PSTRING(256)
Width1 LONG
WidthMax LONG
XPosOpt LONG
YPosOpt LONG
CODE
GETPOSITION(OptFEQ,XPosOpt,YPosOpt)
Prompt1=OptFEQ{PROP:Text} !XPos of Option is Box so +3
IF ~CLIP(Prompt1) THEN Prompt1='Option ' & UseVar. !OPTION,AT() without title
IF Prompt1 THEN
Prompt1 = ' PROMPT(''' & QUOTE(Prompt1) & ''')' & |
',AT(' & XPosOpt+3 &','& YPosOpt &')' & |
',USE(?' & CLIP(UseVar) &':Prompt),TRN <13,10>'
END
WidthMax=20
LOOP RadCount=1 TO 99
RadioFEQ=OptFEQ{PROP:Child,RadCount}
IF ~RadioFEQ THEN BREAK.
ValueRad=RadioFEQ{PROP:Value}
IF ~ValueRad THEN ValueRad=RadCount. !No value then Radio is Index Number
IF RadCount > 1 THEN From1=From1 & '|'.
From1=From1 & QUOTE(RadioFEQ{PROP:Text}) | !|Description
& '|#' & QUOTE(ValueRad) !|#value
Width1=RadioFEQ{PROP:Width} !Use Widest Radio to size LIST width
IF Width1 AND WidthMax < Width1 THEN WidthMax = Width1.
END
WidthMax += 8 !The drop button is 12 but Radio width includes Radio Icon
RadCount -= 1
IF RadCount < 9 THEN RadCount=9 ELSE RadCount += 5. !use DROP(9) if < 9
List1=' LIST' & |
',AT(' & XPosOpt+3 &','& YPosOpt+11 &',' & WidthMax & ',11)'& |
',USE(' & CLIP(UseVar) &')' & |
',VSCROLL,DROP(' & RadCount & ')' & |
', |<13,10> {6}FROM(''' & From1 & ''')'
IF OptFEQ{PROP:Tip} THEN
List1=List1 &', |<13,10> {7}TIP(''' & QUOTE(CLIP(OptFEQ{PROP:Tip})) &''')'
END
IF OrdinalType > 1 THEN
EXECUTE OrdinalType
OrdinalCode=''
OrdinalCode='#ORDINAL( )'
OrdinalCode='#ORDINAL( ' & OptFEQ &' )'
END
List1=List1 &', |<13,10> ' & OrdinalCode
END
CodeGen = CodeGen & '!-{70} FEQ # ' & OptFEQ &' -----' & |
'<13,10>' & Prompt1 & | !Has <13,10> if not blank
List1 & '<13,10>'
EXIT
!#############################################################################################
Option2List PROCEDURE() !Generate LIST without DROP
! MODULE('RTL') !MAP Requires this
! ClaFieldNameRTL(LONG pFEQ),CSTRING,RAW,NAME('Cla$FIELDNAME'),DLL(dll_mode)
! END
CodeGen ANY
OptFEQ LONG
UseVar CSTRING(80)
OrdinalType LONG
CODE
OrdinalType = Message('Include #ORDINAL() in the generated code? ' & |
'||If filled in with the #ORDINAL( # ) of the OPTION it will link the Embeds.' & |
'||ORDINAL should be the FEQ. Warning: they will change as you delete RADIOs.', |
'Option 2 List w/o Drop',ICON:Question, |
'NO Ordinal()|#ORDINAL( )|#ORDINAL( FEQ )')
LOOP OptFEQ=FIRSTFIELD() TO LASTFIELD() !This is in FEQ Order vs PROP:NextField is odd order
IF OptFEQ{PROP:Type} <> Create:Option THEN CYCLE.
UseVar=ClaFieldNameRTL(OptFEQ)
IF ~UseVar then UseVar='feq#' & OptFEQ. !Should not happen
IF UseVar[1]='?' then !Always get ?Var
UseVar=SUB(UseVar,2,LEN(UseVar)-1) !Assume we have USE(Var)
END
DO Gen1OptionRtn
END
IF OrdinalType=3 THEN
CodeGen ='!Warning: #Oridinal() set to FEQ. If WRONG you will link to the WRONG Embeds and messs things up !!!' & |
'<13,10>' & CodeGen
END
SETCLIPBOARD(CodeGen)
Message('Option 2 LIST Code is on the Clipboard','Option2List')
RETURN
!--------------------
Gen1OptionRtn ROUTINE
DATA
Prompt1 PSTRING(256)
OrdinalCode PSTRING(256)
List1 ANY
From1 ANY
RadCount LONG
RadioFEQ LONG
ValueRad PSTRING(256)
Width1 LONG
WidthMax LONG
XPosOpt LONG
YPosOpt LONG
CODE
GETPOSITION(OptFEQ,XPosOpt,YPosOpt)
Prompt1=OptFEQ{PROP:Text} !XPos of Option is Box so +3
IF ~CLIP(Prompt1) THEN Prompt1='Option ' & UseVar. !OPTION,AT() without title
IF Prompt1 THEN
Prompt1 = ' PROMPT(''' & QUOTE(Prompt1) & ''')' & |
',AT(' & XPosOpt+3 &','& YPosOpt &')' & |
',USE(?' & CLIP(UseVar) &':Prompt),TRN <13,10>'
END
WidthMax=20
LOOP RadCount=1 TO 99
RadioFEQ=OptFEQ{PROP:Child,RadCount}
IF ~RadioFEQ THEN BREAK.
ValueRad=RadioFEQ{PROP:Value}
IF ~ValueRad THEN ValueRad=RadCount. !No value then Radio is Index Number
IF RadCount > 1 THEN From1=From1 & '|'.
From1=From1 & QUOTE(RadioFEQ{PROP:Text}) | !|Description
& '|#' & QUOTE(ValueRad) !|#value
Width1=RadioFEQ{PROP:Width} !Use Widest Radio to size LIST width
IF Width1 AND WidthMax < Width1 THEN WidthMax = Width1.
END
RadCount -= 1
WidthMax += 0 !Radio width includes Radio Icon about 10
!Code 99% like DROP procedure, adjust AT() and no DROP.
List1=' LIST' & |
',AT(' & XPosOpt+3 &','& YPosOpt+11 | !AT(X,Y
&','& WidthMax &','& 2 + 8 * RadCount &')'& | ! ,W,H)
',USE(' & CLIP(UseVar) &')' & |
',VSCROLL' & | !No ,DROP(' & RadCount & ')' & |
', |<13,10> {6}FROM(''' & From1 & ''')'
IF OptFEQ{PROP:Tip} THEN
List1=List1 &', |<13,10> {7}TIP(''' & QUOTE(CLIP(OptFEQ{PROP:Tip})) &''')'
END
IF OrdinalType > 1 THEN
EXECUTE OrdinalType
OrdinalCode=''
OrdinalCode='#ORDINAL( )'
OrdinalCode='#ORDINAL( ' & OptFEQ &' )'
END
List1=List1 &', |<13,10> ' & OrdinalCode
END
CodeGen = CodeGen & '!-{70} FEQ # ' & OptFEQ &' -----' & |
'<13,10>' & Prompt1 & | !Has <13,10> if not blank
List1 & '<13,10>'
EXIT
!#############################################################################################
!################################# Test Option2DropList ###################################
TEST_Option2List PROCEDURE()
GLO:PrintRptSequence STRING(1)
GLO:ContractYearWanted STRING(1)
GLO:ContractStatusWanted STRING(8)
ExpiredStatus STRING(1)
Window WINDOW('Option2List Test'),AT(,,579,154),GRAY,SYSTEM,FONT('Segoe UI',9)
BUTTON('Option 2 Drop List'),AT(30,46,86),USE(?OP2ListDropBtn)
BUTTON('Option 2 List'),AT(30,66,86),USE(?OP2ListNoDropBtn),TIP('LIST without DROP')
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 Automati' & |
'c 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
BUTTON('Cl&ose'),AT(30,86,86),USE(?CloseBtn),STD(STD:Close)
END
CODE
OPEN(Window)
ACCEPT
CASE Accepted()
OF ?OP2ListDropBtn ; Option2DropList()
OF ?OP2ListNoDropBtn ; Option2List()
END
END
!#############################################################################################
!#############################################################################################
OMIT('!**End Test Window 1**')
Paste_Test_Window1_Here routine
DATA
DropListTest WINDOW('Option2DropList Test'),AT(,,579,154),GRAY,SYSTEM,FONT('Segoe UI',9)
! ===== Paste Option2DropList code below to open in Designer and Preview =====
!---------------------------------------------------------------------- FEQ # 2 -----
!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 )
END
!end of OMIT('!**End Test Window 1**')
OMIT('!**End Test Window 2**')
Paste_Test_Window1_Here routine
DATA
ListTest WINDOW('Option2List without DROP Test'),AT(,,579,154),GRAY,SYSTEM,FONT('Segoe UI',9)
! ====== Paste Option2List code below to open in Designer and Preview ======
!---------------------------------------------------------------------- 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')
END
!end of OMIT('!**End Test Window 2**')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment