Haiku API Bindings
Control
Not logged in

Documentation | InterfaceKit | Control

SYNOPSIS

Perl

use HaikuR1::Control;

my $control = HaikuR1::Control->new(
    frame        => $frame,
    name         => $name,
    label        => $label,
    message      => $message,
    resizingMode => $resizingMode,
    flags        => $flags,
);

Python

from HaikuR1.InterfaceKit import Control

control = Control(
    frame        = frame,
    name         = name,
    label        = label,
    message      = message,
    resizingMode = resizingMode,
    flags        = flags,
)

DESCRIPTION

Exposes the BControl object.

For more information on Control, see the Be Book class description, the Be Book overview, and the Haiku Book class description.

METHODS

Constructor

Creates a Control.

Perl

HaikuR1::Control->new(
    frame        => $frame,
    name         => $name,
    label        => $label,
    message      => $message,
    resizingMode => $resizingMode,
    flags        => $flags,
);
HaikuR1::Control->new(
    name         => $name,
    label        => $label,
    message      => $message,
    flags        => $flags,
);
HaikuR1::Control->new($archive);

Python

Control(
    frame        = frame,
    name         = name,
    label        = label,
    message      = message,
    resizingMode = resizingMode,
    flags        = flags,
)
Control(
    name         = name,
    label        = label,
    message      = message,
    flags        = flags,
)
Control(archive)

Enabled state

IsEnabled

SetEnabled

Gets or sets the enabled state. SetEnabled can also be called as a hook.

Perl

$control->IsEnabled();
$control->SetEnabled($enabled);

Python

control.IsEnabled()
control.SetEnabled(enabled)

Focus

IsFocusChanging

This function is meant to be called from within a hook to determine whether the focus is changing. This will only be true while the Window is being redrawn as a result of something calling the MakeFocus hook.

Perl

$control->IsFocusChanging();

Python

control.IsFocusChanging()

Icons

IconBitmap

SetIconBitmap

SetIcon

Each Control has an internal list of Bitmaps to use for icons represeting the various possible states (i.e., an icon for on, an icon for off, an icon for on but disabled, etc.). Normally, the Control will simply select the appropriate bitmap for its icon from this internal list.

SetIcon will replace the current icon; on the next state change, one of the internal bitmaps will be used again. SetIconBitmap will replace the given Bitmap in the Control's internal list. IconBitmap will return the given bitmap from the internal list.

You should not change this Bitmap returned by IconBitmap, since other instances of Control or its subclasses may also be using it. If you want to change your Control's appearance, use SetIcon or SetIconBitmap instead.

Perl

$control->IconBitmap($which);
$control->SetIconBitmap($data, $which, $flags);
$control->SetIcon($data, $flags);

Python

control.IconBitmap(which)
control.SetIconBitmap(data, which, flags)
control.SetIcon(data, flags)

An integer. For SetIcon, it is one or more of the icon flag constants.

For SetIconBitmap, the only currently recognized flag is B_KEEP_ICON_BITMAP, which can save some memory by allowing the Control to take over ownership of the Bitmap. From the point of view of your code, this won't make any difference, since the glue code will take this flag into consideration during garbage cleanup. But if SetIconBitmap generates a B_NO_MEMORY error, this flag might resolve the issue.

Label

SetLabel

Gets or sets the label. SetLabel can also be called as a hook.

Perl

$control->Label();
$control->SetLabel($string);

Python

control.Label()
control.SetLabel(string)

Tracking state

IsTracking

SetTracking

This function is meant to be called from within a hook to get or set the tracking state. Several controls use the tracking state to determine whether to respond to MouseMoved events: they set tracking to true between MouseDown and MouseUp events, and then ignore the MouseMoved event unless tracking is on.

Perl

$control->IsTracking();
$control->SetTracking($state);

Python

control.IsTracking()
control.SetTracking(state)

Value

SetValue

SetValueNoUpdate

Gets or sets the value. SetValue can also be called as a hook. SetValueNoUpdate is meant to be called from within a hook, and changes the value without triggering a redraw. (Otherwise, setting the value from within the Draw hook, or any hook that causes Draw to be triggered, could result in an infinite loop.)

Perl

$control->Value();
$control->SetValue($value);
$control->SetValueNoUpdate($value);

Python

control.Value()
control.SetValue(value)
control.SetValueNoUpdate(value)

ARCHIVABLE INTERFACE

Control inherits the methods and hooks of Archivable.

HANDLER INTERFACE

Control inherits the methods and hooks of Handler.

VIEW INTERFACE

Control inherits the methods and hooks of View.

CONSTANTS

Control states

Perl

use HaikuR1::Control qw(:states)

Python

Python does not support export tags.

SCRIPTING SUITE

The name of Control's scripting suite is suite/vnd.Be-control.

Control also inherits the following suites: