Jump to content

wpSetStyle

From EDM2

This instance method is **called to allow an object to set its current object style**.

Syntax

_wpSetStyle(somSelf, ulNewStyle)

Parameters

somSelf (WPObject *) - input
Pointer to the object on which the method is being invoked.
Points to an object of class WPObject.
ulNewStyle (ULONG) - input
Object styles.
Possible values include:
OBJSTYLE_CUSTOMICON: The icon is destroyed when the object goes dormant.
OBJSTYLE_NOCOPY: This object cannot be copied.
OBJSTYLE_NODELETE: This object cannot be deleted.
OBJSTYLE_NODRAG: This object cannot be dragged.
OBJSTYLE_NODROP: No other object can be dropped on this object.
OBJSTYLE_NOMOVE: This object cannot be moved.
OBJSTYLE_NOPRINT: This object cannot be printed.
OBJSTYLE_NORENAME: This object cannot be renamed.
OBJSTYLE_NOSETTINGS: This object cannot be set.
OBJSTYLE_NOTVISIBLE: This object is hidden.
OBJSTYLE_TEMPLATE: This object is a template.
OBJSTYLE_LOCKEDINPLACE: Lock this object in place.

Returns

rc (BOOL) - returns
Success indicator.
    • TRUE: Successful completion**.
    • FALSE: Error occurred**.

Remarks

This method is equivalent to calling `wpModifyStyle` with a specific `ulStyleFlags` and `ulStyleMask` to set or clear styles. The `wpQueryTrueStyle` method always 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.

Usage

This method can be **called at any time in order 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        ulNewStyle; /* Object styles. */
BOOL         rc;         /* Success indicator. */

rc = _wpSetStyle(somSelf, ulNewStyle);

The following example removes the template style from the object so it can be deleted:

_wpSetStyle( objMyPrt
, (_wpQueryStyle( objMyPrt ) & ~OBJSTYLE_TEMPLATE ) );
somPrintf("About to delete MyPrt Object\n");
_wpDelete( objMyPrt /* Object to delete */
, 0); /* No confirmations on the delete */

Related Methods