ISlider

The ISlider class allows a user to set, display, or modify a value by moving the slider arm along the slider shaft.


1 - Slider arm
An arm the user can move along the shaft to set slider values. The slider arm shows the current value by its position on the slider shaft and can be changed by your code, as well as by the user.
2 - Slider shaft
A track for the slider arm to move along.
3 - Slider buttons
Buttons that move the slider arm one increment in the indicated direction.
4 - Detent
A user-selectable mark that can be placed anywhere along the slider scale.
5 - Tick text
A label indicating the value that the tick mark represents.
6 - Tick mark
A mark indicating an increment on the slider scale. Tick marks are evenly spaced along the shaft.

Sliders let a user set values that have familiar increments, such as feet or degrees. You can also use sliders to blend colors or show the percentage of a task completed. Because the slider is interactive, detents and buttons are provided and the slider arm is oversized to facilitate interaction with the mouse.

By default, this class creates a slider as follows:

The horizontal slider has several alternate styles. You can do the following:

A complementary set of options is available for creating a vertical slider. You can do the following:

Other style options include the following:

Handlers derived from the following classes handle events for ISlider objects:

Portability Considerations

There are restrictions for specifying the color of controls based on the platform and which style of control you use.

AIX Considerations

The AIX version does not support detents.

Windows Considerations

The native Windows slider (that is, a slider constructed without the pmCompatible style) does not support detents.


ISlider - Member Functions and Data by Group

Constructors & Destructor

You can construct and destruct objects of this class.


[view class]
~ISlider
public:
virtual ~ISlider()

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
ISlider


Overload 1
public:
ISlider( unsigned long windowId, IWindow* parent, IWindow* owner, const IRectangle& initial, unsigned long scale1NumberOfTicks, unsigned long scale1TickSpacing, unsigned long scale2NumberOfTicks, unsigned long scale2TickSpacing = 0, const Style& style = defaultStyle ( ) )

You can construct an object of this class by specifying the number of ticks and spacing for both scale 1 and scale 2.

windowId
A unique ID for the slider control.
parent
The parent window.
owner
The owner window.
initial
A rectangle defining the size and placement of the slider window.
scale1NumberOfTicks
The number of ticks to place on scale 1 of the slider.
scale1TickSpacing
The number of pixels between ticks on scale 1.
scale2NumberOfTicks
The number of ticks to place on scale 2 of the slider.
scale2TickSpacing
The number of pixels between ticks on scale 2. The default is 0. Optional.
style
The style of the control. Optional.

Exception

IInvalidParameter The parent window pointer specified was invalid. You must specify a valid IWindow pointer as the parent.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes

AIX Considerations

The constructors wrapping an existing progress indicator are not available in the AIX environment.

Windows Considerations

The constructors wrapping an existing slider are not supported for native Windows sliders.


Overload 2
public:
ISlider( unsigned long windowId, IWindow* parent, IWindow* owner, const IRectangle& initial, unsigned long numberOfTicks, unsigned long tickSpacing = 0, const Style& style = defaultStyle ( ) )
You can construct objects of this class by using this primary constructor.
windowId
A unique ID for the slider control.
parent
The parent window.
owner
The owner window.
initial
A rectangle defining the size and placement of the slider window.
numberOfTicks
The number of ticks to place on the primary scale of the slider.
tickSpacing
The number of pixels between ticks. The default is 0. The default causes the slider to evenly space the ticks on the shaft. If you specify a value for tickSpacing, this constructor determines the length of the slider shaft based on this value and the number of ticks. Optional.
style
The style of the control. Optional.

Exception

IInvalidParameter The parent window pointer specified was invalid. You must specify a valid IWindow pointer as the parent.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 3
public:
ISlider(const IWindowHandle& handle)

You can construct an object of this class by specifying a window handle.

handle
The window handle of the slider control.

Supported Platforms

Windows OS/2 AIX
Yes Yes No

AIX Considerations

The constructors wrapping an existing progress indicator are not available in the AIX environment.

Windows Considerations

You can use this constructor to wrapper a native Windows trackbar. ISlider objects constructed from native Windows trackbars will set the initial number of ticks to two and the tick spacing to zero. Call setTicks after wrappering the control to initialize the scale(s).


Overload 4
public:
ISlider(unsigned long windowId, IWindow* parent)

You can construct an object of this class by specifying a parent window and a slider control ID.

windowId
A unique ID for the slider control.
parent
The parent window.

Supported Platforms

Windows OS/2 AIX
Yes Yes No

Windows Considerations

You can use this constructor to wrapper a native Windows trackbar. ISlider objects constructed from native Windows trackbars will set the initial number of ticks to two and the tick spacing to zero. Call setTicks after wrappering the control to initialize the scale(s).


Arm Operations

Use these members to set and query attributes of the slider arm.


[view class]
armSize
public:
ISize armSize() const

Returns the size of the arm in pixels.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes

Windows Considerations

Native Windows sliders (that is, sliders constructed without the pmCompatible style) do not support arm sizing. Therefore, this member function returns a default ISize object for native Windows sliders.


[view class]
setArmSize
public:
virtual ISlider& setArmSize(const ISize& sliderArm)

Sets the size of the arm in pixels.

sliderArm
Object that represents the horizontal and vertical dimensions of the slider arm.

Exception

IInvalidParameter The slider arm size requested is invalid.

Supported Platforms

Windows OS/2 AIX
Yes Yes Ignored

Windows Considerations

Native Windows sliders (that is, sliders constructed without the pmCompatible style) do not support arm sizing. Therefore, this member function has no effect for native Windows sliders.


Attributes

Use this member to query the accessible attribute of objects of this class.


[view class]
hasFocus
public:
virtual bool hasFocus() const

Returns true if the slider has the input focus.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Buttons Position

Use these members to query the position of slider buttons (if any).


[view class]
buttonsPosition
public:
ButtonsPosition buttonsPosition() const

Returns the current position of the slider's buttons for this slider object. The returned value is an enumerator provided by ButtonsPosition.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Detent Operations

Use these members to set and query attributes for a slider's detents.


[view class]
addDetent
public:
virtual unsigned long addDetent(unsigned long offset)

Adds a detent to the slider at the specified pixel offset from the home position. Returns a unique ID, which is required for removing a detent or querying its position.

Exception

IInvalidParameter The detent offset requested is invalid.

Supported Platforms

Windows OS/2 AIX
Yes Yes Ignored

Windows Considerations

Native Windows sliders (that is, sliders constructed without the pmCompatible style) do not support detents. Therefore, this member function returns has no effect for native Windows sliders.


[view class]
detentPosition
public:
virtual unsigned long detentPosition( unsigned long detentId ) const

Returns the offset of a detent from the home position, in pixels.

detentId
The detent identifier whose position is to be returned.

Exception

IInvalidParameter The detent identifier is invalid.

Supported Platforms

Windows OS/2 AIX
Yes Yes Ignored

Windows Considerations

Native Windows sliders (that is, sliders constructed without the pmCompatible style) do not support detents. Therefore, this member function returns 0 for native Windows sliders.


[view class]
removeDetent
public:
virtual ISlider& removeDetent(unsigned long detentId)

Removes the specified detent from the slider.

detentId
Detent to remove.

Exception

IInvalidParameter The detent identifier is invalid.

Supported Platforms

Windows OS/2 AIX
Yes Yes Ignored

Windows Considerations

Native Windows sliders (that is, sliders constructed without the pmCompatible style) do not support detents. Therefore, this member function has no effect for native Windows sliders.


Notification Members

Use this member to identify notifications sent to an observer object.


[view class]
armTrackId
public:
static INotificationId const armTrackId

Notification identifier provided to observers when the arm of an ISlider window is dragged with the mouse. ISlider provides the current arm position in the INotificationEvent::eventData field of the INotificationEvent.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Styles

These style members provide a set of valid styles for this class. Use these members to query and set the slider styles. You can use these styles with the styles in the following classes:


[view class]
convertToGUIStyle
public:
virtual unsigned long convertToGUIStyle( const IBitFlag& style, bool extendedOnly = false ) const

Converts a style object into a value appropriate for the presentation system. The default action is to return the base GUI styles for the platform. Extended styles, those defined by the application and the Open Class Library, are returned if you set extendedOnly to true.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
defaultStyle
public:
static Style defaultStyle()

Returns the default style. The default style is classDefaultStyle unless you have changed the style using setDefaultStyle.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setDefaultStyle
public:
static void setDefaultStyle(const Style& style)

Sets the default style for all subsequent sliders.

style
Use the styles provided by ISlider Styles to specify the default style.

This member function is not thread safe. In a multithreaded application, it should only be called when a conflict is not possible. A conflict can arise if you set the default style on one thread at the same time that it is being queried on another. In this situation, the query would take place while the style is in an unknown state.

When you create a window class and do not specifically specify window styles in the constructor, the Open Class Library queries the default style. Therefore, the only safe place to call this member function is when no other application threads that create windows are active.

Another way to avoid a conflict in a multithreaded application is to specifically specify window styles on window construction, rather than calling this member function.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
buttonsBottom
public:
static const Style buttonsBottom

Places the slider's buttons below the slider shaft.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
buttonsLeft
public:
static const Style buttonsLeft

Places the slider's buttons to the left of the slider shaft.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
buttonsRight
public:
static const Style buttonsRight

Places the slider's buttons to the right of the slider shaft.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
buttonsTop
public:
static const Style buttonsTop

Places the slider's buttons above the slider shaft.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
classDefaultStyle
public:
static const Style classDefaultStyle

Provides the original default style for this class, which is the following: IWindow::visible | IProgressIndicator::horizontal | IProgressIndicator::alignCentered | IProgressIndicator::homeLeft | IProgressIndicator::primaryScale1 | ISlider::buttonsLeft.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


ISlider - Enumerations


[view class]
ButtonsPosition
enum ButtonsPosition { top, 
                       bottom, 
                       left, 
                       right, 
                       none }

Use these enumerators to specify the placement of the slider's buttons. The buttons are used to move the slider arm one increment in the selected direction.

top
Places the slider's buttons above the slider shaft.
bottom
Places the slider's buttons below the slider shaft.
left
Places the slider's buttons to the left of the slider shaft.
right
Places the slider's buttons to the right of the slider shaft.
none
The slider has no buttons.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


ISlider - Inherited Member Functions and Data

Inherited Public Functions

IControl
INotifier
IProgressIndicator
IWindow

Inherited Public Data

IWindow
IProgressIndicator
INotifier

Inherited Protected Functions

IWindow
INotifier
IProgressIndicator
IControl

Inherited Protected Data