326
Appendix A: System Routines — Apps
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
OO_SetAttr
Declaration:
BOOL
OO_SetAttr
(pFrame
obj
, ULONG
selector
, void *
value
)
Category(ies):
Apps
Description:
Sets the value of an attribute in an object frame. If the frame is marked
read-only, attribute slot search continues in the frame’s parent object.
Inputs:
obj
— Object frame where attribute search should begin.
selector
— Attribute selector number.
value
— New value for attribute. The value may be any integer or
pointer which fits in 32 bits. Integer values must be cast to
(void *) to avoid compiler warning messages.
Outputs:
Returns TRUE if the attribute value was updated. This routine will return
FALSE if all the frames in the object hierarchy are read-only or it runs out
of heap memory while attempting to expand the frame to add a new
attribute slot.
Assumptions:
Rarely would you call
OO_SetAttr
directly. The FDL compiler (see section
7.3.3.3. Frame Description Language
) compiles attribute declarations
into access macros with the call to
OO_SetAttr
containing the proper
selector number, value and return type casts. You would call the macro
instead of
OO_SetAttr
.
Side Effects:
May cause heap compression.
Availability:
On AMS 2.02 and higher.
TI-89 / TI-92 Plus
Differences:
None
See Also: OO_CondGetAttr, OO_GetAppAttr, OO_GetAttr, OO_HasAttr,
OO_SetAppAttr
Example:
/* Set running app’s default menu */
ACB *pacb = HeapDeref(EV_runningApp);
OO_SetAttr(pacb->appData, OO_APP_DEFAULT_MENU, &menu);
/* OO_SetAttr will give up if all frames in the app’s parent hierarchy are marked
read-only. It is better to call OO_SetAppAttr: */
OO_SetAppAttr(EV_runningApp, OO_APP_DEFAULT_MENU, &menu);
/* Better yet, call the macro generated by FDL: */
SetAppDefaultMenu(EV_runningApp, &menu);
/* Actually, there is a routine in the OS which does exactly this. . . */
EV_registerMenu(&menu);