zijn weliswaar estetisch opgesteld, maar je wordt er echt niet wijs uit. Ik zeg niet dat je plotseling het licht zal zien met de formatering hieronder, maar ze is wel een stuk logischer.
Ik koos voor 3 spaties om een indent te simuleren, maar dat is een persoonlijke keuze die ook een beetje door de "screen real estate" bepaald wordt.
Case (
Month ( CalendarDates ) = Month ( Extend ( gDate ) ) ;
// the month of the current repetition of CalendarDates the same as the navigational month
Case (
CalendarDates = Get ( CurrentDate ) ;
// display today
TextSize (
TextStyleAdd (
TextColor (
TextFont ( Day ( CalendarDates ) ; Extend ( gCalTodayFont ) ) ;
RGB ( Extend ( gCalTodayRed ) ; Extend ( gCalTodayGreen ) ; Extend ( gCalTodayBlue ) )
) ;
Evaluate ( Extend ( gCalTodayStyle ) )
) ;
Extend ( gCalTodaySize )
) ;
// display the other days of the "active" month
TextSize (
TextStyleAdd (
TextColor (
TextFont ( Day ( CalendarDates ) ; Extend ( gCalTextFont ) ) ;
RGB ( Extend ( gCalTextRed ) ; Extend ( gCalTextGreen ) ; Extend ( gCalTextBlue ) )
) ;
Evaluate ( Extend ( gCalTextStyle ) )
) ;
Extend ( gCalTextSize )
)
) ;
// the days outside the current month get a different colour
TextSize (
TextStyleAdd (
TextColor (
TextFont ( Day ( CalendarDates ) ; Extend ( gCalTextFont ) ) ;
RGB ( 90 ; 90; 90 )
) ;
Evaluate ( Extend ( gCalTextStyle ) )
) ;
Extend ( gCalTextSize )
)
)
Merk op dat je nu veel beter de uitsplitsing van de 2 geneste case functies ziet, en ook de combinatie van tekst opmaak functies . Ik probeer hier een logicia te hanteren die programmeurs al jaren gebruiken, vooral als je achteraf nog wil kunnen lezen wat je gemaakt hebt, is dit eigenlijk een absolute must.
Het is niet altijd mogelijk om de dingen netjes te formateren. Als je FileMaker Developer gebruikt, is het een goed idee om formules compacter te krijgen door custom functies te verzinnen.
Ten slotte is een goed geplaatse comment in een formule van onschatbare waarde.
En je kan het ook helemaal anders uitschrijven, deze manier van formules schrijven is nog iets duidelijker vind ik:
Let (
theDay = Day ( CalendarDates ) ;
Case (
Month ( CalendarDates ) = Month ( Extend ( gDate ) ) ;
// the month of the current repetition of CalendarDates the same as the navigational month
Case (
CalendarDates = Get ( CurrentDate ) ;
// display today
Let (
[
theFont = Extend ( gCalTodayFont ) ;
theColour = RGB ( Extend ( gCalTodayRed ) ; Extend ( gCalTodayGreen ) ; Extend ( gCalTodayBlue ) ) ;
theStyle = Evaluate ( Extend ( gCalTodayStyle ) ) ;
theSize = Extend ( gCalTodaySize )
] ;
TextSize ( TextStyleAdd ( TextColor ( TextFont ( theDay ; theFont ) ; theColour ) ; theStyle ) ; theSize )
);
// display the other days of the "active" month
Let (
[
theFont = Extend ( gCalTextFont ) ;
theColour = RGB ( Extend ( gCalTextRed ) ; Extend ( gCalTextGreen ) ; Extend ( gCalTextBlue ) ) ;
theStyle = Evaluate ( Extend ( gCalTextStyle ) ) ;
theSize = Extend ( gCalTextSize )
] ;
TextSize ( TextStyleAdd ( TextColor ( TextFont ( theDay ; theFont ) ; theColour ) ; theStyle ) ; theSize )
)
) ;
// the days outside the current month get a different colour
Let (
[
theFont = Extend ( gCalTextFont ) ;
theColour = RGB ( 90 ; 90; 90 ) ;
theStyle = Evaluate ( Extend ( gCalTextStyle ) ) ;
theSize = Extend ( gCalTextSize )
] ;
TextSize ( TextStyleAdd ( TextColor ( TextFont ( theDay ; theFont ) ; theColour ) ; theStyle ) ; theSize )
)
)
)
Question
Peter Wagemans
Calculaties als deze (Uit Calendar Navigator - schitterend ding):
Case ( Month ( CalendarDates ) = Month ( Extend ( gDate ) ) ; Case ( CalendarDates = Get ( CurrentDate ) ; TextSize ( TextStyleAdd ( TextColor ( TextFont ( Day ( CalendarDates ) ; Extend ( gCalTodayFont ) ) ; RGB ( Extend ( gCalTodayRed ) ; Extend ( gCalTodayGreen ) ; Extend ( gCalTodayBlue ) ) ) ; Evaluate ( Extend ( gCalTodayStyle ) ) ) ; Extend ( gCalTodaySize ) ) ; TextSize ( TextStyleAdd ( TextColor ( TextFont ( Day ( CalendarDates ) ; Extend ( gCalTextFont ) ) ; RGB ( Extend ( gCalTextRed ) ; Extend ( gCalTextGreen ) ; Extend ( gCalTextBlue ) ) ) ; Evaluate ( Extend ( gCalTextStyle ) ) ) ; Extend ( gCalTextSize ) ) ) ; TextSize ( TextStyleAdd ( TextColor ( TextFont ( Day ( CalendarDates ) ; Extend ( gCalTextFont ) ) ; RGB ( 90 ; 90; 90 ) ) ; Evaluate ( Extend ( gCalTextStyle ) ) ) ; Extend ( gCalTextSize ) ) )zijn weliswaar estetisch opgesteld, maar je wordt er echt niet wijs uit. Ik zeg niet dat je plotseling het licht zal zien met de formatering hieronder, maar ze is wel een stuk logischer.
Ik koos voor 3 spaties om een indent te simuleren, maar dat is een persoonlijke keuze die ook een beetje door de "screen real estate" bepaald wordt.
Case ( Month ( CalendarDates ) = Month ( Extend ( gDate ) ) ; // the month of the current repetition of CalendarDates the same as the navigational month Case ( CalendarDates = Get ( CurrentDate ) ; // display today TextSize ( TextStyleAdd ( TextColor ( TextFont ( Day ( CalendarDates ) ; Extend ( gCalTodayFont ) ) ; RGB ( Extend ( gCalTodayRed ) ; Extend ( gCalTodayGreen ) ; Extend ( gCalTodayBlue ) ) ) ; Evaluate ( Extend ( gCalTodayStyle ) ) ) ; Extend ( gCalTodaySize ) ) ; // display the other days of the "active" month TextSize ( TextStyleAdd ( TextColor ( TextFont ( Day ( CalendarDates ) ; Extend ( gCalTextFont ) ) ; RGB ( Extend ( gCalTextRed ) ; Extend ( gCalTextGreen ) ; Extend ( gCalTextBlue ) ) ) ; Evaluate ( Extend ( gCalTextStyle ) ) ) ; Extend ( gCalTextSize ) ) ) ; // the days outside the current month get a different colour TextSize ( TextStyleAdd ( TextColor ( TextFont ( Day ( CalendarDates ) ; Extend ( gCalTextFont ) ) ; RGB ( 90 ; 90; 90 ) ) ; Evaluate ( Extend ( gCalTextStyle ) ) ) ; Extend ( gCalTextSize ) ) )Merk op dat je nu veel beter de uitsplitsing van de 2 geneste case functies ziet, en ook de combinatie van tekst opmaak functies . Ik probeer hier een logicia te hanteren die programmeurs al jaren gebruiken, vooral als je achteraf nog wil kunnen lezen wat je gemaakt hebt, is dit eigenlijk een absolute must.
Het is niet altijd mogelijk om de dingen netjes te formateren. Als je FileMaker Developer gebruikt, is het een goed idee om formules compacter te krijgen door custom functies te verzinnen.
Ten slotte is een goed geplaatse comment in een formule van onschatbare waarde.
En je kan het ook helemaal anders uitschrijven, deze manier van formules schrijven is nog iets duidelijker vind ik:
Let ( theDay = Day ( CalendarDates ) ; Case ( Month ( CalendarDates ) = Month ( Extend ( gDate ) ) ; // the month of the current repetition of CalendarDates the same as the navigational month Case ( CalendarDates = Get ( CurrentDate ) ; // display today Let ( [ theFont = Extend ( gCalTodayFont ) ; theColour = RGB ( Extend ( gCalTodayRed ) ; Extend ( gCalTodayGreen ) ; Extend ( gCalTodayBlue ) ) ; theStyle = Evaluate ( Extend ( gCalTodayStyle ) ) ; theSize = Extend ( gCalTodaySize ) ] ; TextSize ( TextStyleAdd ( TextColor ( TextFont ( theDay ; theFont ) ; theColour ) ; theStyle ) ; theSize ) ); // display the other days of the "active" month Let ( [ theFont = Extend ( gCalTextFont ) ; theColour = RGB ( Extend ( gCalTextRed ) ; Extend ( gCalTextGreen ) ; Extend ( gCalTextBlue ) ) ; theStyle = Evaluate ( Extend ( gCalTextStyle ) ) ; theSize = Extend ( gCalTextSize ) ] ; TextSize ( TextStyleAdd ( TextColor ( TextFont ( theDay ; theFont ) ; theColour ) ; theStyle ) ; theSize ) ) ) ; // the days outside the current month get a different colour Let ( [ theFont = Extend ( gCalTextFont ) ; theColour = RGB ( 90 ; 90; 90 ) ; theStyle = Evaluate ( Extend ( gCalTextStyle ) ) ; theSize = Extend ( gCalTextSize ) ] ; TextSize ( TextStyleAdd ( TextColor ( TextFont ( theDay ; theFont ) ; theColour ) ; theStyle ) ; theSize ) ) ) )Als je nu nog de
vervangt door een custom functie CF_Format ( theDay ; theFont ; theColour ; theStyle ; theSize ) ben je er helemaal.
0 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.