Home |
Obtaining a Pointer to PegPresentationManager Determining the Position of an Object Using Object IDs |
Using Object IDsA few object ID values starting at 1000 are reserved for proper operation of dialog boxes and message windows. Therefore, custom IDs should always begin enumerations with a value of 1, so as not to overlap the reserved ID values, which are at the very top of the valid ID range. The reserved object Ids are: enum PegButtonIds { IDB_CLOSE = 1000, IDB_SYSTEM, IDB_OK, IDB_CANCEL, IDB_APPLY, IDB_ABORT, IDB_YES, IDB_NO, IDB_RETRY, }; Buttons with the Ids listed above are given special treatment by dialog and message window classes. For further information, see PegDialog and PegMessageWindow. Object ID values can be used to identify an 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. A child object can be located using the object's ID with the Find() function. Find will search the child list of the current object for an object with an ID value matching the passed in value. Object IDs are also useful for identifying top-level windows. It is often the case that one window needs to locate another window without knowing whether the other window is actually displayed. The following code segments illustrate using Window ID values to locate a top-level window: Window1::Window1(...) : PegDecoratedWindow(...) { Id(ID_WINDOW1); } PegDecoratedWindow * Window2::FindWindow1(void) { return Presentation()->Find(ID_WINDOW1); }
|