wxRuby Documentation Home

# Wx::Gauge

A gauge is a horizontal or vertical bar which shows a quantity (often time).

Gauge supports two working modes: determinate and indeterminate progress.

The first is the usual working mode (see set_value
and set_range) while the second can be used when
the program is doing some processing but you don’t know how much progress is
being done.
In this case, you can periodically call the Pulse
function to make the progress bar switch to indeterminate mode (graphically
it’s usually a set of blocks which move or bounce in the bar control).

Gauge supports dynamic switch between these two work modes.

There are no user commands for the gauge.

## Derived from

Control

Window

EvtHandler

Object

## Window styles

`GA_HORIZONTAL` | Creates a horizontal gauge.
`GA_VERTICAL` | Creates a vertical gauge.
`GA_SMOOTH` | Creates smooth progress bar with one pixel wide update step (not supported by all platforms).

See also window styles overview.

## Event handling

Gauge is read-only so generates no events.

## See also

Slider, ScrollBar

## Methods

- Gauge.new
- Gauge#create
- Gauge#get_bezel_face
- Gauge#get_range
- Gauge#get_shadow_width
- Gauge#get_value
- Gauge#is_vertical
- Gauge#set_bezel_face
- Gauge#set_range
- Gauge#set_shadow_width
- Gauge#set_value
- Gauge#pulse

### Gauge.new

Gauge.new(%(arg-type)Window% parent, Integer id, Integer range, Point pos = DEFAULT_POSITION, Size size = DEFAULT_SIZE, Integer style = GA_HORIZONTAL, Validator validator = DEFAULT_VALIDATOR, String name = “gauge”)

Constructor, creating and showing a gauge.

#### Parameters

- parent Window parent.
- id Window identifier.
- range Integer range (maximum value) of the gauge. It is ignored when the gauge is used in indeterminate mode.
- pos Window position.
- size Window size.
- style Gauge style. See Gauge.
- name Window name.

#### See also

Gauge#create

destructor()

Destructor, destroying the gauge.

### Gauge#create

Boolean create(%(arg-type)Window% parent, Integer id, Integer range, Point pos = DEFAULT_POSITION, Size size = DEFAULT_SIZE, Integer style = GA_HORIZONTAL, Validator validator = DEFAULT_VALIDATOR, String name = “gauge”)

Creates the gauge for two-step construction. See Gauge.new for further details.

### Gauge#get_bezel_face

Integer get_bezel_face()

Returns the width of the 3D bezel face.

#### Remarks

This method is not implemented (returns $0$) for most platforms.

#### See also

Gauge#set_bezel_face

### Gauge#get_range

Integer get_range()

Returns the maximum position of the gauge.

#### See also

Gauge#set_range

### Gauge#get_shadow_width

Integer get_shadow_width()

Returns the 3D shadow margin width.

#### Remarks

This method is not implemented (returns $0$) for most platforms.

#### See also

Gauge#set_shadow_width

### Gauge#get_value

Integer get_value()

Returns the current position of the gauge.

#### See also

Gauge#set_value

### Gauge#is_vertical

Boolean is_vertical()

Returns if the gauge is vertical (has `GA_VERTICAL` style) and
otherwise.

### Gauge#set_bezel_face

set_bezel_face(%(arg-type)Integer% width)

Sets the 3D bezel face width.

#### Remarks

This method is not implemented (doesn’t do anything) for most platforms.

#### See also

Gauge#get_bezel_face

### Gauge#set_range

set_range(%(arg-type)Integer% range)

Sets the range (maximum value) of the gauge.
This function makes the gauge switch to determinate mode, if it’s not already.

#### See also

Gauge#get_range

### Gauge#set_shadow_width

set_shadow_width(%(arg-type)Integer% width)

Sets the 3D shadow width.

#### Remarks

This method is not implemented (doesn’t do anything) for most platforms.

### Gauge#set_value

set_value(%(arg-type)Integer% pos)

Sets the position of the gauge.
This function makes the gauge switch to determinate mode, if it’s not already.

#### Parameters

- pos Position for the gauge level.

#### See also

Gauge#get_value

### Gauge#pulse

pulse()

Switch the gauge to indeterminate mode (if required) and makes the gauge move
a bit to indicate the user that some progress has been made.

Note that after calling this function the value returned by get_value
is undefined and thus you need to explicitely call set_value if you
want to restore the determinate mode.

[This page automatically generated from the Textile source at 2023-06-09 00:45:36 +0000]