> -----Original Message-----
> From: Dragomir Goranov
> Sent: Tuesday, August 05, 2003 8:18 AM
>
> Hi,
> I want to access the internals fields of ControlType
> structures. Here is my
> code:
> //Before including any of the PalmOS system headers I define
> insert this
> line:
> #define ALLOW_ACCESS_TO_INTERNALS_OF_CONTROLS
>
> .....
> //And i want this code to compile
> //But the compiler says:
> //Error: illegal use of incomplete struct 'ControlType'
> Boolean Ctl_Visible(UInt16 CtlID) {
> FormType *form = FrmGetActiveForm();
> ControlType *ctl = (ControlType *) FrmGetObjectPtr
> (form,FrmGetObjectIndex (form,CtlID)); return (ctl->attr.visible); }
>
>
> What am I doing wrong?
You need to make sure this #define is realized by the macro preprocessor
before everything else. In other words, it needs to be one of the first
#defines that 'happens'. If you are using Codewarrior, you can
accomplish this by going into project settings, Language Settings, C/C++
Language section, and specifying a file for 'Prefix File'. Once
specified, you must create this file, add it to your project, and then
you can toss your single #define in it. That should do it.
Note that the prefix file is particular to a target. So if you have
multiple targets (debug and release, for example), you will need to
specify a prefix file for both. You can use the same one, but I
recommend you use "PrefixDebug.h" and "PrefixRelease.h" in this
scenario. Sooner or later, you will want to have a #define that only
exists in the release build for example -- this is the way to do it.
-Jeff Ishaq
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/