WpQueryStyle: Difference between revisions
Created page with "{{DISPLAYTITLE:wpQueryStyle}} This instance method **allows the object to query its current class style**. ==Syntax== _wpQueryStyle(somSelf) ==Parameters== ;''somSelf'' (WPObject *) - input :Pointer to the object on which the method is being invoked. :Points to an object of class WPObject. ==Returns== ;''ulnwQrySt'' (ULONG) - returns :Object styles. :The flags are **ORed together** to indicate the object's style. :Possible values include: ::OBJSTYLE_CUSTO..." |
|||
Line 65: | Line 65: | ||
* [[wpclsQueryStyle]] | * [[wpclsQueryStyle]] | ||
* [[wpSetMenuStyle]] | * [[wpSetMenuStyle]] | ||
[[Category:Workplace Instance Methods]] |
Latest revision as of 00:17, 2 September 2025
This instance method **allows the object to query its current class style**.
Syntax
_wpQueryStyle(somSelf)
Parameters
- somSelf (WPObject *) - input
- Pointer to the object on which the method is being invoked.
- Points to an object of class WPObject.
Returns
- ulnwQrySt (ULONG) - returns
- Object styles.
- The flags are **ORed together** to indicate the object's style.
- Possible values include:
- OBJSTYLE_CUSTOMICON: Icon is destroyed when 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; however, this object can be dragged and dropped on other objects.
- OBJSTYLE_NOMOVE: This object cannot move.
- 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.
Remarks
This method returns the **dynamic value of the style based on the current state of the object**. In contrast, the `wpQueryTrueStyle` method always returns the persistent style of the object as last set by `wpModifyStyle` or `wpSetStyle`. 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 in order to **determine the current style for an object class**.
How to Override
This method is **intended to be overridden by object classes**. The override may return different style flags based on the current state of the object.
Example Code
Declaration:
#define INCL_WINWORKPLACE #include <os2.h> WPObject *somSelf; /* Pointer to the object on which the method is being invoked. */ ULONG ulnwQrySt; /* Object styles. */ ulnwQrySt = _wpQueryStyle(somSelf);
The following example, adapted from `wpSetStyle`, demonstrates how `_wpQueryStyle` might be used:
// Assuming objMyPrt is a WPObject pointer // Remove the template style from the object so it can be deleted _wpSetStyle( objMyPrt , (_wpQueryStyle( objMyPrt ) & ~OBJSTYLE_TEMPLATE ) );