ButtonGadget

Object List Next Object

Definition:

A ButtonGadget is a template for other gadgets. There are three styles of ButtonGadgets that can be placed in ObjectBoxes. The style is controlled by the ButtonType property.

Specialized Features:

The following table lists and describes the properties, methods, and events that are added by ButtonGadget.


Properties Use to...


ButtonType Determine the style of the button. Three styles are available.

Enabled Determine whether or not the gadget should be enabled.

Left Reflect the offset from the parent ObjectBox's upper left corner.

Name Define the name of the gadget relative to the Object box that it is in.

Parent Refer to the ObjectBox that contains the gadgets.

Position Control where in an ObjectBox a gadget will appear.

Separator Define how much space appears between this gadget and the next gadget. Valid only if the Parent ObjectBox's LayoutStyle property is set to ToolBar.

ShadowStyle Control what the border of a gadget is drawn like; with or without a shadow.

State Put the gadget in the appropriate state by pushing it down or popping it up.

Top Reflect the offset from the parent ObjectBox's upper left corner.


Methods Use to...


DetailedEdit Bring up a form for providing more information when an object is double clicked in the Property Editor or a control on a form is double clicked while the Form Editor is on.

Refresh Makes the gadget re-get its bitmap and redraw it.

TextUnload Append to 'cmds' any statements necessary to regenerate the object from text.


Events Use to...


Click Perform an action when the user presses and releases a mouse button while on an object, or when the value of a control is changed in code.

DblClick Perform an action when the user presses and releases a mouse button twice in rapid succession over an object.

DragAndDrop Raised on drag-and-drop targets during a drag operation.

DragStart Define what occurs when a drag-and-drop operation is initiated.

Enable Keep the "enabled" state of the gadget correct.

HintText

MouseDown Define what occurs when the user presses any mouse button.

MouseMove Define the actions that occur when a user moves the mouse pointer.

MouseUp Define what occurs when the user releases any mouse button.

Copied Features:

Noneimages/Phx00010.gifthis is a top-level object.

Details:

When a gadget is shown in an ObjectBox it uses a Bitmap to display its face. This Bitmap is asked for *only* one time when the Gadget is first displayed. To supply the picture, the gadget must have one of the following:

images/Phx90000.gif An object reference property named "bitmap."

images/Phx90000.gif An embedded object named "bitmap."

images/Phx90000.gif A function named "bitmap" that returns a Bitmap object.

images/Phx90000.gif A procedural property of type Bitmap.

After the Bitmap is retrieved, the only way to change what picture is shown for a gadget is to either call Refresh on the gadget, or to call ForceLayout (True). ForceLayout (True) calls Refresh on all the gadgets.

The easiest way to supply the picture is to copy the ButtonGadget object and make a new object called "MyGadget." Then, on MyGadget, add an embedded Bitmap object called "bitmap." Using this new kind of gadget makes the configuration of the Bitmap painless.

If you want pop-up help to appear when the mouse lingers over a gadget in an ObjectBox, include a member named "HintText" on the gadget. This member can be implemented by placing one of the following on the gadget:

images/Phx90000.gif A String property

images/Phx90000.gif A Procedural String property

images/Phx90000.gif A Function that returns a String

There are advantages and disadvantages to each implementation, however, the easiest way to implement pop-up help, is to place a String property on the gadget called "HintText." Whatever string this property holds will automatically be shown for the "hint" when the mouse lingers over the gadget. If the string is empty, then no hint is displayed.

The use of a procedural property or a function allows the gadget to display different text depending on dynamic conditions, allowing the message to change each time the text is asked for.

See Also:
Bitmap, ObjectBox