TButton Class Reference

[tvision Index] [tvision Hierarchy] [Headers]


The button view More...

#include <dialogs.h>

Inherits: TView

Public Members

Protected Members


Detailed Description

One of the most used and easy to use views.


TButton( const TRect& bounds, const char *aTitle, ushort aCommand, ushort aFlags ) [public]

Constructor.

`bounds' is the bounding rectangle of the button. `aTitle' is a pointer to a string which will be the caption of the button. `aCommand' is the command generated when the user presses the button. `aFlags' is a bitmap of the following values:

0x00 bfNormal - this is a normal button

0x01 bfDefault - default button

0x02 bfLeftJust - justifies the title at the left

0x04 bfBroadcast - sends a broadcast message when pressed

0x08 bfGrabFocus - the button grabs the focus when pressed

Note: you can use only one default button. However the default property can be passed to normal buttons by calling makeDefault().

See Also:
TButton::amDefault, TButton::makeDefault

~TButton() [public]

Destructor.

void draw() [public virtual]

Draws the button.

void drawState( Boolean down ) [public]

Called by draw().

See Also:
TButton::draw

TPalette& getPalette() const [public virtual]

Returns a reference to the standard TButton palette.

void handleEvent( TEvent& event ) [public virtual]

Handles TButton events.

void makeDefault( Boolean enable ) [public]

Changes the default property of this button.

This method does nothing if the button is a default button (i.e. it has the bfDefault bit set). Otherwise the button gets or releases his default property depending on the value of the `enable' flag. If `enable' is True, the button grabs the default property from the default button (if exists) and the default button losts the default property. If `enable' is False, the button releases the default property to the default button (if exists). This allows a normal button (without the bfDefault bit set) to behave like a default button.

void press() [public virtual]

This method is called whenever the button is pressed.

Its task is to send a message. The message is a broadcast message to the owner of the view if the button has the bfBroadcast bit set, otherwise the message is a command message.

void setState( ushort aState, Boolean enable ) [public virtual]

Changes the state of the button.

See Also:
TView::setState

const char *title[public]

This is a pointer to the caption of the button.

static const char * shadows[public]

A pointer to the shadow characters.

These characters are used to draw the button shadow.

TStreamable* build() [public static]

Creates a new TButton.

Used to recover the view from a stream.

ushort command[protected]

This is the command generated when the user presses the button.

uchar flags[protected]

This variable stores the various bfXXXX flags of the button.

See Also:
TButton::TButton

Boolean amDefault[protected]

If True the button has the default property.

The default button is automatically selected when the user presses the Enter key. If this variable is False, the button is a normal button.

TButton( StreamableInit ) [protected]

Constructor.

Used to recover the view from a stream.

void write( opstream& os ) [protected virtual]

Used to store the view in a stream.

void* read( ipstream& is ) [protected virtual]

Used to recover the view from a stream.


Documentation generated by sergio@athena.milk.it on Wed Feb 10 22:11:47 CET 1999
Kdoc