The generic item creates items whose appearance and response to mouse and keyboard messages can be customized. The item hook function manages all behavior of a generic item. Unlike all other items, the dialog box manager provides no default behavior for a generic item.

MDL_Programmer's_Guide-14-12-06.jpg

Item list specification

The item hook function uses the DialogItemRsc field extent to specify the location of the generic item. If the DITEM_MESSAGE_SETEXTENT message is not handled, the upper left corner of the item will be at the position specified by extent.origin and the item's width and height will be extent.width and extent.height, respectively.

The type field should be Generic.

The ID determines the DItem_GenericRsc instance to load.

The attributes field can be ON or OFF and optionally combined with HIDDEN. It will usually be ON.

The itemArg field is unused and should usually be set to 0.

The label field can pass a string to the item hook function at DITEM_MESSAGE_CREATE time. diMsg.u.create.labelP will point at this field.

The auxInfo field is unused for generic items and should be set to "".

The following is an example of a generic item list specification:

{{XC, YC, 10*YC, 10*YC}, Generic, GENERICID_Cell, ON, 0, "", ""}

Item resource specification

The generic item is defined in a resource file with the following structure:

typedef struct ditem_genericrsc
{
ULong helpInfo;
ULong helpSource;
long itemHookId;
long itemHookArg;

The following is an example of a generic item resource. This item is used in the Cells dialog box, and is defined in MicroStation's resource file.

{
};

Item hook function messages

The following messages are sent to item hook functions that are attached to generic items:

  DITEM_MESSAGE_CREATE
  DITEM_MESSAGE_INIT
  DITEM_MESSAGE_DESTROY
  DITEM_MESSAGE_DRAW
  DITEM_MESSAGE_FONTCHANGED
  DITEM_MESSAGE_MOVE
  DITEM_MESSAGE_SETEXTENT
  DITEM_MESSAGE_BUTTON
  DITEM_MESSAGE_SYNCHRONIZE
  DITEM_MESSAGE_HIGHLIGHT
  DITEM_MESSAGE_KEYSTROKE
  DITEM_MESSAGE_FOCUSIN
  DITEM_MESSAGE_FOCUSOUT
  DITEM_MESSAGE_SETLABEL
  DITEM_MESSAGE_GETVALUE
  DITEM_MESSAGE_SETVALUE
  DITEM_MESSAGE_GETSTATE
  DITEM_MESSAGE_SETSTATE
  DITEM_MESSAGE_STATECHANGED
  DITEM_MESSAGE_QUEUECOMMAND

dimP->dialogItemP->attributes.acceptsKeystrokes should be set to FALSE at DITEM_MESSAGE_CREATE time if the item should not be able to accept the input focus. KEYSTROKE, FOCUSIN and FOCUSOUT messages will not be generated.

dimP->dialogItemP->attributes.mouseSensitive should be set to FALSE if the item should not be able to respond to mouse events. BUTTON messages will not be generated.

Generic item functions

There are no generic item functions.


Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.