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)
frame
A Rect that indicates where on the parent Window the View should be. You should not specify a frame on a View that will be added to a parent which uses a Layout.
name
A string, the Control's internal name.
label
A string, the text that will be displayed on the Control.
message
A Message that will be sent when the Control is Invoked.
resizingMode
An integer, the resizing mode. (See the resizing mode constants.) Should only be specified when there is a frame. Defaults to
B_FOLLOW_NONE
.flags
An integer, view flags. (See the view flag constants.)
archive
A Message, contains an archived version of the Control.
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)
enabled
A boolean, the new enabled state.
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)
which
An integer, one of the icon option constants.
data
A Bitmap containing the new image 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)
string
A string, the new label.
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)
state
A boolean, the new tracking 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)
value
An integer, the new value; one of the control state constants.
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.
- B_CONTROL_ON
- B_CONTROL_OFF
- B_CONTROL_PARTIALLY_ON
SCRIPTING SUITE
The name of Control's scripting suite is suite/vnd.Be-control
.
Properties
Enabled
B_GET_PROPERTY
,B_SET_PROPERTY
a boolean, the enabled state
Label
B_GET_PROPERTY
,B_SET_PROPERTY
a string, the control label
Value
B_GET_PROPERTY
,B_SET_PROPERTY
an integer, the control value
Control also inherits the following suites: