Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
#define
Message
 
 
À
17/04/2018 11:57:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Database:
Visual FoxPro
Divers
Thread ID:
01659466
Message ID:
01659499
Vues:
51
>Hi,
>
>I would like to make use of constants to set my grids colours, have therefore issued :
>
>
>#DEFINE ACTIVEROWFORECOL		16711680		&&KOBALT blue
>#DEFINE ROWFORECOL			0 			&&black
>This.SetAll( 'DynamicForeColor', ;
>	'IIF( RECNO( This.RecordSource ) = This.nRecNo, ACTIVEROWFORECOL, ROWFORECOL )', 'COLUMN' )
>
>
>errors
>
>wheras
>
>This.SetAll( 'DynamicForeColor', ;
>	'IIF( RECNO( This.RecordSource ) = This.nRecNo, 16711680, 0 )', 'COLUMN' )
>
>
>works smouthly
>How should I correct my statement using #DEFINE?
>
>Rgds,
>
>Koen

Consider creating enumerations instead. I am now working on a project with thousands of defines, all scattered around. Complete nightmare, defeats the purpose of simplification.

I would prefer:
LOCAL loColorcodes AS ColorCodes of Appsettings_Colors.vcx
loColorcodes = NEWOBJECT("ColorCodes", "Appsettings_Colors.vcx")

This.SetAll( 'DynamicForeColor', TEXTMERGE( 'IIF( RECNO( This.RecordSource ) = This.nRecNo, <<loColorCodes.ActiveRow>>, <<loColorCodes.RowForecolor>> )'), 'COLUMN' )
This strategy enables you to:
- Handle all color codes centrally
- Create factories to switch codes for different situations (user preferences etc)
- Use IntelliSense (no errors because of wrong spelling)
- Reusability
Christian Isberner
Software Consultant
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform