I never tried to do a GUI without a GUI designer and now I'm learning how to develop Palm OS applications with the book Palm OS Programming: The Developers Guide. And on it I have this code that is a declaration of some GUI items:
#define HelloWorldForm 1000
#define HelloWorldButtonButton 1003
#define HelloWorldMenuBar 1000
#define GoodnightMoonAlert 1101
#define FirstBeep 1010
#define SecondBeepmore 1000
I want to know some things:
They resource IDs. You aren't required to define such macros, but if you don't, you'll instead have to use the raw integer values when you try to refer to the UI widgets in code. For example, the typical way you'd get a pointer to a UI control would be to call:
FormType* formP = FrmGetActiveForm();
UInt16 index = FrmGetObjectIndex(formP, objectID);
ControlType* controlP = FrmGetObjectPtr(formP, index);
You'd need to get pointers to the UI widgets in order to do things such as reading their states (such as for checkboxes), changing text labels, showing or hiding them dynamically, etc.
There's no type safety between the resource IDs and what you do with the pointer you get back from FrmGetObjectPtr
; it's your responsibility to keep track of which ID corresponds to which type of control (the common practice is to use descriptive names).