TCPmaker : Visual Tour    Sending Messages to Screen Controls  

One word of caution - each Control Message function must be ENABLED before you can use it. The code is set up this way so that the Control Message API will only consume program memory for those parts that you actually use.

To show you how to do that, take a look at this small part of (the C18 version of) file mtControls.h:

// **********************************************************************
//
// Control Message API Function prototypes
//
// NOTE:
// =====
// All of these functions are DISABLED by default, to save program memory.
//
// Before you can use any of these functions, you must first enable it by
// UN-commenting the conditional compile #define statement just before the
// function prototype in file mtControls.h

//#define USE_mtSetTextRom
// mtSetTextRom - Set the text of a control
void mtSetTextRom(rom char *id, rom char *value);

//#define USE_mtSetTextSize
// mtSetTextSize - Set the size of text on the display
void mtSetTextSize(rom char *id, int points, int xscale, int yscale);

 . . .

 

The #defines are all commented out in the as-generated code. All you have to do to enable, say, the mtSetTextSize() function, is to remove the two slashes "//" to enable the #define USE_mtSetTextSize and allow this function to compile.

Remember that if you try to use one of these functions, but forget to enable it, you will get a linker error that says the linker cannot find a definition of this function.  To fix that linker error, just enable the corresponding #define in file mtControls.h and recompile.

 
  

4 of 33
Copyright Notice and Author Information