Wiki Home

Setting Properties From Compile Constants

Namespace: WIN_COM_API
Please how can I set a property Form to a #DEFINE value...
I have a form and a incluide file (.h) y establish the include file as the include file of de form,
but I can't set properties of the form to map #DEFINE values of the include file.

By explample:


I want to ser the Form.BackColor property to MYCOLOR directly from de VFP IDE at desing time no at runtime (by example coding at Init form even like.... This Form.BackColor = MIVALOR)


I'd like to know this, too: It seemed to me that it sometimes works, and sometimes doesn't, though I don't understand the pattern yet. Try including the header file by going to Form-Menu and choose "Include File", and then try just putting the constant in the property sheet. Or, try preceeding the constant name with "=", like THISFORM.BackColor = "=MIVALOR", (in the property sheet, of course).

Also, you may not know: The form properties are available in the THISFORM.Load event, which executes before the form is visible, and before any controls are instantiated on the form, and is practically as good as setting the properties in the property sheet (for all intents and purposes). -- ?wgcs

That's simple: DEFINE Contants are in reality nothing more than Search-and-Replace commands, which the compiler applies to the sourcecode before he actually compiles it. Therefor, DEFINEs only work in real sourcecode. Property-Assignments aren't compilable sourcecode, only Methods and Events are. Therefor you can't use DEFINEs in the propertysheet, but you can use them in any Event, like LOAD etc. ?wOOdy

Category Open Questions, Category Vfp Properties
( Topic last updated: 2004.12.20 01:25:46 PM )