Haiku API Bindings
Slider
Not logged in

Documentation | InterfaceKit | Slider

SYNOPSIS

Perl

use HaikuR1::Slider qw(:hash_mark_location :thumb_style);

my $slider = HaikuR1::Slider->new(
    frame        => $frame,
    name         => "$name 1",
    label        => $label,
    message      => $message,
    minValue     => $min_value,
    maxValue     => $max_value,
    posture      => $posture,
    thumbType    => $thumbType,
    resizingMode => $resizing_mode,
    flags        => $view_flags,
);
$window->AddChild($slider);

Python

from HaikuR1.InterfaceKit import Slider, B_BUTTON_BEHAVIOR, B_TOGGLE_BEHAVIOR, B_POP_UP_BEHAVIOR

slider = Slider(
    frame        = frame,
    name         = name,
    label        = label,
    message      = message,
    minValue     = min_value,
    maxValue     = max_value,
    posture      = posture,
    thumbType    = thumbType,
    resizingMode = resizingMode,
    flags        = flags,
)
window.AddChild(slider)

DESCRIPTION

Exposes the BSlider object.

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

METHODS

Constructor

Creates a Slider.

Perl

HaikuR1::Slider->new(
    frame => $frame,
    name => $name,
    label => $label,
    message => $message,
    minValue => $minValue,
    maxValue => $maxValue,
    posture => $posture,
    thumbType => $thumbType,
    resizingMode => $resizingMode,
    flags => $flags,
);
HaikuR1::Slider->new($archive);

Python

Slider(
    frame = frame,
    name = name,
    label = label,
    message = message,
    minValue = minValue,
    maxValue = maxValue,
    posture = posture,
    thumbType = thumbType,
    resizingMode = resizingMode,
    flags = flags,
)
Slider(archive)

Frames

BarFrame

HashMarksFrame

ThumbFrame

Gets the indicated frame Rect.

Perl

$slider->BarFrame();
$slider->HashMarksFrame();
$slider->ThumbFrame();

Python

slider.BarFrame()
slider.HashMarksFrame()
slider.ThumbFrame()

Limits

GetLimits

SetLimits

MinLimitLabel

MaxLimitLabel

SetLimitLabels

Gets or sets the ends of the Slider's range, or the labels associated with those values. SetLimits and SetLimitLabels may also be called as hooks.

Note: the limit labels are blank by default.

Perl

$slider->GetLimits();
$slider->SetLimits($min, $max);
$slider->MinLimitLabel();
$slider->MaxLimitLabel();
$slider->SetLimitLabels($minLabel, $maxLabel);

Python

slider.GetLimits()
slider.SetLimits(min, max)
slider.MinLimitLabel()
slider.MaxLimitLabel()
slider.SetLimitLabels(minLabel, maxLabel)

OffscreenView

If the C++ code has been compiled with a particular setting, all rendering will be done in an offscreen view. If the C++ code has not been compiled with that setting, this method will return the Slider itself.

Either way, if you want to change the way something is drawn in one of your overridden hooks, you should call this method and draw to the returned View.

Perl

$slider->OffscreenView();

Python

slider.OffscreenView()

Position

SetPosition

Gets or sets the current position of the Slider knob.SetPosition may also be called as a hook.

Perl

$slider->Position();
$slider->SetPosition($position);

Python

slider.Position()
slider.SetPosition(position)

Properties

ModificationMessage

SetModificationMessage

SnoozeAmount

SetSnoozeAmount

KeyIncrementValue

SetKeyIncrementValue

HashMarkCount

SetHashMarkCount

HashMarks

SetHashMarks

Style

SetStyle

BarColor

SetBarColor

FillColor

UseFillColor

Orientation

SetOrientation

BarThickness

SetBarThickness

These methods do what you expect. The setter methods may also be called as hooks. By default, a Slider:

The difference between the standard Control message and the modification message is that the modification message is sent when the user is changing the value (i.e., while the mouse button is held down, or when a key is pressed) and the standard message is sent when the user has finished changing the value (i.e., the mouse or key is released).

If you want to change some element in real time while the user is changing the value, the set a modification message and use it to track those changes. If you only care about what the user's final choice of value was, leave the modification message empty and don't worry about it.

Perl

$slider->ModificationMessage();
$slider->SetModificationMessage($message);
$slider->SnoozeAmount();
$slider->SetSnoozeAmount($amount);
$slider->KeyIncrementValue();
$slider->SetKeyIncrementValue($value);
$slider->HashMarkCount();
$slider->SetHashMarkCount($count);
$slider->HashMarks();
$slider->SetHashMarks($where);
$slider->Style();
$slider->SetStyle($style);
$slider->BarColor();
$slider->SetBarColor($color);
$slider->FillColor();
$slider->UseFillColor($color);
$slider->Orientation();
$slider->SetOrientation($posture);
$slider->BarThickness();
$slider->SetBarThickness($thickness);

Python

slider.ModificationMessage()
slider.SetModificationMessage(message)
slider.SnoozeAmount()
slider.SetSnoozeAmount(amount)
slider.KeyIncrementValue()
slider.SetKeyIncrementValue(value)
slider.HashMarkCount()
slider.SetHashMarkCount(count)
slider.HashMarks()
slider.SetHashMarks(where)
slider.Style()
slider.SetStyle(style)
slider.BarColor()
slider.SetBarColor(color)
slider.FillColor()
slider.UseFillColor(color)
slider.Orientation()
slider.SetOrientation(posture)
slider.BarThickness()
slider.SetBarThickness(thickness)

UpdateTextChanged

Signals that the has update text has changed; this will result in the UpdateText hook being called.

Perl

$slider->UpdateTextChanged();

Python

slider.UpdateTextChanged()

HOOKS

Drawing

DrawSlider

DrawBar

DrawHashMarks

DrawThumb

DrawFocusMark

DrawText

Called during drawing, allowing you to override an individual element without overriding the entire Draw hook. Draw calls DrawSlider, which calls the other five methods.

Perl

$slider->DrawSlider();
$slider->DrawBar();
$slider->DrawHashMarks();
$slider->DrawThumb();
$slider->DrawFocusMark();
$slider->DrawText();

Python

slider.DrawSlider()
slider.DrawBar()
slider.DrawHashMarks()
slider.DrawThumb()
slider.DrawFocusMark()
slider.DrawText()

UpdateText

MaxUpdateTextWidth

UpdateText is called when the system needs to fetch the update text. The default version returns an empty string.

MaxUpdateTextWidth is called when the system needs to determine how much space to reserve for the update text. The default version currently returns the width of the label for the maximum value.

Perl

$slider->UpdateText();
$slider->MaxUpdateTextWidth();

Python

slider.UpdateText()
slider.MaxUpdateTextWidth()

ValueForPoint

Called when the user changes the Slider position with the mouse.

Perl

$slider->ValueForPoint($point);

Python

slider.ValueForPoint(point)

CONSTANTS

Hash mark location

Perl

use HaikuR1::Slider qw(:hash_mark_location)

Python

Python does not support export tags.

Thumb style

Perl

use HaikuR1::Slider qw(:thumb_style)

Python

Python does not support export tags.

SCRIPTING SUITE

Slider inherits the following suites: