Jump to content

WM MEASUREITEM

From EDM2

This notification is sent to the owner of a specific control to establish the height and width for an item in that control.

Syntax

param1
    SHORT  sIdentity;     /* Control identifier. */

param2
    ULONG  ulControlSpec; /* Control-specific information. */

returns
    SHORT  sHeight;       /* Height of item. */
    SHORT  sWidth;        /* Width of item. */

in List Boxes

This notification is sent to the owner of a list box control to establish the height and width for an item in that control.

param1
     SHORT  sListBox    /*  List-box identifier. */

param2
     SHORT  sItemIndex  /*  Item index. */

returns
     SHORT  sHeight     /*  Height of item. */
     SHORT  sWidth      /*  Width of item. */

in Menu Controls

This notification is sent to the owner of a menu control to establish the height for an item in that control.

param1
     SHORT       sMenu       /*  Menu identifier. */

param2
     POWNERITEM  pOwnerItem  /*  Owner-item structure. */

Parameters

sIdentity (SHORT) - input
Control identifier.
ulControlSpec (ULONG) - input
Control-specific information.
The meaning of the control-specific information depends on the type of control. For details of each control type, refer to the appropriate control section.
sHeight (SHORT) - output
Height of item.
sWidth (SHORT) - output
Width of item.

in List Boxes

sListBox (SHORT)- input
List-box identifier.
sItemIndex (SHORT)- input
Item index.
The zero-based index of the item which has changed.

in Menu Controls

sMenu (SHORT) - input
Menu identifier.
pOwnerItem (POWNERITEM) - input
Owner-item structure.
This points to an OWNERITEM structure.

Returns

sHeight (SHORT) - returns
Height of item.
sWidth (SHORT) - returns
Width of item.

in List Boxes

sHeight (SHORT)
Height of item.
sWidth (SHORT)
Width of item.
This value is required only if the list box control is scrollable horizontally, that is, it has a style of LS_HORZSCROLL.

in Menu Controls

sHeight (SHORT)- output
Height of item.

Remarks

in Frame Controls

The identity of the top-level action bar menu that generated this message is found. If the identity is FID_MENU, the message is passed to the window with identity FID_CLIENT.

in List Boxes

This message is sent to the owner of a list box that has a style of LS_OWNERDRAW, to offer the owner an opportunity to establish the height and width (for a horizontally scrollable list box control) of an item that accommodates any special requirements for the drawing of items in that list box. It is sent when items in the list box are inserted or deleted, and also when presentation parameters for the list box change.

All items in a list box must have the same height, which must be greater than or equal to the height of the current font.

In particular, this notification is sent to the owner of a list box that has a style of LS_OWNERDRAW, to offer the owner an opportunity to establish the height and width (for a horizontally scrollable list box control) of an item that accommodates any special requirements for the drawing of items in that list box.

in Menu Controls

This message is only sent at the time the menu control is created. When the owner receives this message, it must calculate and return the height of an item to the control.

All items in a menu must have the same height, and that must be greater than or equal to the height of the current font.

In particular, this notification is sent to the owner of a menu that has a style of MIS_OWNERDRAW, to offer the owner an opportunity to establish the height of an item that accommodates any special requirements for the drawing of items in that menu. When the owner receives this message, it must calculate and return the height and width of an item to the control. Typically, the client window procedure processes WM_MEASUREITEM by filling in the yTop and Right fields of the RECTL structure specified by the rclItem field of the OWNERITEM structure; this specifies the size of the rectangle needed to enclose the item when it is drawn.

Default Processing

The default window procedure does not expect to receive this message and therefore takes no action on it, other than to set ReturnCode to the default value of 0.

in Frame Controls

The default window procedure does not expect to receive this message and therefore takes no action on it, other than to set sHeight to the default value of 0.

in List Boxes

The default window procedure does not expect to receive this message and therefore takes no action on it, other than to set sHeight to the default value of 0.

in Menu Controls

The default window procedure does not expect to receive this message and therefore takes no action on it, other than to set sHeight to the default value of 0.

Example

in Menu Controls

The following code fragment responds to a WM_MEASUREITEM message.

    case WM_MEASUREITEM:
        ((POWNERITEM) mp2)->rclItem.xRight = 26;
        ((POWNERITEM) mp2)->rclItem.yTop = 10;
        return 0;


Related Messages

  • WM_MEASUREITEM (in Frame Controls)
  • WM_MEASUREITEM (in List Boxes)
  • WM_MEASUREITEM (in Menu Controls)