wpModifyStyle
This method is **specific to Version 3, or higher, of the OS/2 operating system**.
This instance method **modifies the current object style for the given object**.
Syntax
_wpModifyStyle(somSelf, ulStyleFlags, ulStyleMask)
Parameters
- somSelf (WPObject *) - input
- Pointer to the object on which the method is being invoked.
- Points to an object of class WPObject.
- ulStyleFlags (ULONG) - input
- Flag indicating the object's styles to be affected.
- Possible values include:
- OBJSTYLE_NOPRINT: This object cannot be printed.
- OBJSTYLE_NODRAG: This object cannot be dragged.
- OBJSTYLE_NOTVISIBLE: This object is not visible.
- OBJSTYLE_NORENAME: This object cannot be renamed.
- OBJSTYLE_NODROP: No other object can be dropped on this object; however, this object can be dragged and dropped on other objects.
- OBJSTYLE_NOSETTINGS: This object does not have a Settings view.
- ulStyleMask (ULONG) - input
- Style flags in ulStyleFlags to be set or cleared.
- Values specified correspond to the styles specified in ulStyleFlags. If the value in ulStyleMask is specified (the bit is 1), the corresponding style flag is set. If the value in ulStyleMask is not specified (the bit is 0), the corresponding style flag is cleared.
Returns
- rc (BOOL) - returns
- Success indicator.
- TRUE: Successful completion**.
- FALSE: Error occurred**.
Remarks
This method **sets and clears corresponding style flags as an atomic operation**. It can be used in place of the `wpQueryStyle` and `wpSetStyle` instance methods.
This method returns the **persistent style of the object**, as last set by `wpModifyStyle` or `wpSetStyle`. In contrast, the `wpQueryStyle` method returns the **dynamic value of the style based on the current state of the object**. For example, if an object is temporarily not moveable, `wpQueryStyle` would reflect this temporary state (containing `OBJSTYLE_NOMOVE`), while `wpQueryTrueStyle` would return the object's persistent style which might not contain this flag.
To determine the **default style for an object class**, the `wpclsQueryStyle` method should be called.
Usage
This method can be **called at any time to change an object's style**.
How to Override
This method is **generally not overridden**.
Example Code
Declaration:
#define INCL_WINWORKPLACE #include <os2.h> WPObject *somSelf; /* Pointer to the object on which the method is being invoked. */ ULONG ulStyleFlags; /* Flag indicating the object's styles to be affected. */ ULONG ulStyleMask; /* Style flags in ulStyleFlags to be set or cleared. */ BOOL rc; /* Success indicator. */ rc = _wpModifyStyle(somSelf, ulStyleFlags, ulStyleMask);
The following code changes the style of an object to 'not moveable', 'not copyable', 'deleteable'.
_wpModifyStyle (self, OBJSTYLE_NOMOVE | OBJSTYLE_NOCOPY | OBJSTYLE_NODELETE, OBJSTYLE_NOMOVE | OBJSTYLE_NOCOPY);