%DateTimeDisplayCode #GROUP 

Top  Previous  Next

This #GROUP generates the code to actually display the Date and/or Time.

#GROUP(%DateTimeDisplayCode)

   #IF(%DisplayDate)

     #IF(%ShowDayOfWeek)

       #CASE(%DateDisplayLocation)

       #OF('Control')

 %DateControl{Prop:Text} = CLIP(DisplayDayText[(TODAY()%%7)+1]) & ', ' &  %|

                                FORMAT(TODAY(),%DateUsePicture)

 DISPLAY(%DateControl)

       #ELSE

 %Window{Prop:StatusText,%DateStatusSection} = CLIP(DisplayDayText[(  %|

         TODAY()%%7)+1]) & ', ' & FORMAT(TODAY(),%DateUsePicture)

       #ENDCASE

     #ELSE

       #CASE(%DateDisplayLocation)

       #OF('Control')

 %DateControl{Prop:Text} = FORMAT(TODAY(),%DateUsePicture)

 DISPLAY(%DateControl)

       #ELSE

 %Window{Prop:StatusText,%DateStatusSection} = FORMAT(TODAY(),%DateUsePicture)

       #ENDCASE

     #ENDIF

   #ENDIF

   #IF(%DisplayTime)

     #CASE(%TimeDisplayLocation)

     #OF('Control')

 %TimeControl{Prop:Text} = FORMAT(CLOCK(),%TimeUsePicture)

 DISPLAY(%DateControl)

     #ELSE

 %Window{Prop:StatusText,%TimeStatusSection} = FORMAT(CLOCK(),%TimeUsePicture)

     #ENDCASE

   #ENDIF

 

The #IF(%DisplayDate) structure generates the code to display the date. The #IF(%ShowDayOfWeek) structure detects the programmer's choice to display the day along with the date, then #CASE(%DateDisplayLocation) generates the code to display into a STRING display-only control for the #OF('Control') clause.

The assignment statement concatenates the day of the week (from the DisplayDayText[(TODAY() %% 7)+1] expression) with the formatted date (from the FORMAT(TODAY(),%DateUsePicture) expression) into the STRING(text) property (the %DateControl{Prop:Text} property). The %% generates as a single % (modulus operator) for the TODAY() % 7 + 1 expression to get the correct day of the week text from the DisplayDayText array. The #ELSE clause of the #CASE(%DateDisplayLocation) assigns the same expression to the status bar section the programmer chose for the date display.

The #ELSE clause of the #IF(%ShowDayOfWeek) structure performs the same assignments, without the day of the week. The #IF(%DisplayTime) structure performs the same type of assignments of the formatted time to either a STRING display-only control or the status bar.