Pegthing Type And Attributes; Pegthing Type; Pegthing Object Ids - Casio ClassPad 300 Programming Manual

Sdk programming guide
Hide thumbs Also See for ClassPad 300:
Table of Contents

Advertisement

PegThing Type and Attributes

PegThing Type

All PEG objects have a member variable called muType, which is a logical type
indicator. You can retrieve or set an object's muType value by calling the Type()
functions:
UCHAR Type(void) { return muType; }
void
Type(UCHAR uSet) {muType = uSet;}
Type() called with no arguments will return that PegThing's type, whereas Type() called
with a UCHAR will set the object's type.
This can be useful when you are searching your child object list for objects of a certain
type. This value is also useful when debugging since at times you may have a pointer to a
PegThing and wish to know exactly what type of PegThing the pointer points to. After
checking the muType member of a PegThing, you can safely upcast a PegThing pointer
to a pointer to a specific PEG object type. The possible return values of the Type()
function are defined in the header file pegtypes.hpp. The following code fragment
illustrates one possible method of locating the status bar attached to a window:
PegThing *pTest = First(); // get pointer to first child object
while(pTest) // search to the end of list if necessary
{
if (pTest->Type() == TYPE_STATUS_BAR)
{
PegStatusBar *pStatBar = (PegStatusBar *) pTest;
//use pStatBar to call member functions or change attributes
break; // found the status bar, exit the loop
}
pTest = pTest->Next(); // continue down the list of children
}

PegThing Object IDs

Another way to find a specific PegThing is with its Object ID. You can assign each
PegThing a unique object ID value that can then be used to identify the object. When an
object sends a notification signal to a parent window, the object ID is contained in the
iData member of the notification message. If you do not give an object ID to a PegThing,
then that PegThing will not send notification signals.
To get and set an object's ID, use the following functions:
WORD Id(void) {return mwId;}
void Id(WORD wId) {mwId = wId;}
12

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents