FORMAT() Runtime Properties

Top  Previous  Next

The properties of the individual fields and groups in a multi-column LIST or COMBO control can also be set using the property equates for each (the PROPLIST:Item listed above for each property). These properties eliminate the need to create a complete FORMAT attribute string just to change a single property of a single field in the LIST.

These are all property arrays that require an explicit array element number following the property equate (separated by a comma) to specify which column in the LIST or COMBO is affected. All of them contain blank ('') if missing, and a one (1) if present.

Example:

  PROGRAM

  MAP

DisplayList     PROCEDURE

PrintList       PROCEDURE

RandomAlphaData PROCEDURE(*STRING)

  END

 

TreeDemo  QUEUE               !Data list box FROM queue

FName      STRING(20)

ColorNFG   LONG(COLOR:White)  !Normal Foreground color for FName

ColorNBG   LONG(COLOR:Maroon) !Normal Background color for FName

ColorSFG   LONG(COLOR:Yellow) !Selected Foreground color for FName

ColorSBG   LONG(COLOR:Blue)   !Selected Background color for FName

IconField  LONG               !Icon number for FName

TreeLevel  LONG               !Tree Level

LName      STRING(20)

Init       STRING(4)

         END

CODE

DisplayList

PrintList

 

DisplayList    PROCEDURE

Win WINDOW('List Boxes'),AT(0,0,366,181),SYSTEM,DOUBLE

    LIST,AT(0,34,366,146),FROM(TreeDemo),USE(?Show),HVSCROLL,   |

    FORMAT('80L*IT~First Name~*80L~Last Name~16C~Initials~')

   END

 

CODE

LOOP X# = 1 TO 20

 RandomAlphaData(TreeDemo.FName)

 TreeDemo.IconField = ((X#-1) % 4) + 1       !Assign icon number

 TreeDemo.TreeLevel = ((X#-1) % 4) + 1       !Assign tree level

 RandomAlphaData(TreeDemo.LName)

 RandomAlphaData(TreeDemo.Init)

 ADD(TreeDemo)

END

OPEN(Win)

?Show{PROP:iconlist,1} = ICON:VCRback        !Icon 1 = <

?Show{PROP:iconlist,2} = ICON:VCRrewind      !Icon 2 = <<

?Show{PROP:iconlist,3} = ICON:VCRplay        !Icon 3 = >

?Show{PROP:iconlist,4} = ICON:VCRfastforward !Icon 4 = >>

ACCEPT

END

RandomAlphaData PROCEDURE(Field)     !MAP Prototype is: RandomAlphaData(*STRING)

CODE

CLEAR(Field)

RandomSize# = RANDOM(1,SIZE(Field)) !Random fill size

Field[1] = CHR(RANDOM(65,90))       !Start with a random upper case letter

LOOP Z# = 2 to RandomSize#          !Fill each character with

 Field[Z#] = CHR(RANDOM(97,122))    !a random lower case letter

END

PrintList PROCEDURE

DemoQ     QUEUE

FName      STRING(20)

ColorNFG1  LONG

ColorNBG1  LONG

ColorSFG1  LONG(COLOR:Black)  !Printed Foreground color for FName

ColorSBG1  LONG(COLOR:White)  !Printed Background color for FName

LName      STRING(20)

ColorNFG2  LONG

ColorNBG2  LONG

ColorSFG2  LONG(COLOR:Black)  !Printed Foreground color for LName

ColorSBG2  LONG(COLOR:White)  !Printed Background color for LName

Init       STRING(4)

ColorNFG3  LONG

ColorNBG3  LONG

ColorSFG3  LONG(COLOR:Black)  !Printed Foreground color for Init

ColorSBG3  LONG(COLOR:White)  !Printed Background color for Init

Wage       REAL

ColorNFG4  LONG

ColorNBG4  LONG

ColorSFG4  LONG(COLOR:Black)  !Printed Foreground color for Wage

ColorSBG4  LONG(COLOR:White)  !Printed Background color for Wage

         END

 

CustRpt   REPORT,AT(1000,1000,6500,9000),THOUS

CustDetail DETAIL,AT(0,0,6500,200)

           LIST,AT(0,0,6000,200),FORMAT(''),FROM(DemoQ),USE(?Show)

          END

         END

 

CODE

LOOP X# = 1 TO 20

 CLEAR(DemoQ)

 RandomAlphaData(DemoQ.FName)

 RandomAlphaData(DemoQ.LName)

 RandomAlphaData(DemoQ.Init)

 DemoQ.Wage = RANDOM(100000,1000000)/100

 ADD(DemoQ)

END

OPEN(CustRpt)

SETTARGET(CustRpt)

IF RANDOM(0,1)

 ?Show{PROP:Format} = '2000L*~First Name~2000L*~Last Name~500L*~Intls~1000L*~Wage~|'

ELSE

 ?Show{PROP:Format} = '2000L*~First Name~2000L*~Last Name~500L*~Intls~1000D(400)*~Wage~|'

 ?Show{PROPLIST:Header,1} = 'First Field'     !Change first field's header text

 ?Show{PROPLIST:Header + PROPLIST:Group,1} = 'First Group'

END                                           !Change first group's header text

LOOP X# = 1 TO RECORDS(DemoQ)

 GET(DemoQ,X#)

 PRINT(CustDetail)

END

CLOSE(CustRpt)

FREE(DemoQ)