wxRuby Documentation Home

# Wx::Caret

A caret is a blinking cursor showing the position where the typed text will
appear. The text controls usually have a caret but Caret class also allows
to use a caret in other windows.

Currently, the caret appears as a rectangle of the given size. In the future,
it will be possible to specify a bitmap to be used for the caret shape.

A caret is always associated with a window and the current caret can be
retrieved using Window#get_caret. The same caret
can’t be reused in two different windows.

## Derived from

No base class

## Data structures

## Methods

- Caret.new
- Caret#create
- Caret#get_blink_time
- Caret#get_position
- Caret#get_size
- Caret#get_window
- Caret#hide
- Caret#is_ok
- Caret#is_visible
- Caret#move
- Caret#set_blink_time
- Caret#set_size
- Caret#show

### Caret.new

Caret.new(%(arg-type)Window% window, Integer width, Integer height) Caret.new(%(arg-type)WindowBase% window, Size size)

Create the caret of given (in pixels) width and height and associates it
with the given window.

### Caret#create

Boolean create(%(arg-type)WindowBase% window, Integer width, Integer height) Boolean create(%(arg-type)WindowBase% window, Size size)

Create the caret of given (in pixels) width and height and associates it
with the given window (same as constructor).

### Caret#get_blink_time

Integer get_blink_time()

Returns the blink time which is measured in milliseconds and is the time elapsed
between 2 inversions of the caret (blink time of the caret is the same
for all carets, so this functions is static).

### Caret#get_position

get_position(%(arg-type)Integer% x, Integer y) Point get_position()

Get the caret position (in pixels).

### Caret#get_size

get_size(%(arg-type)Integer% width, Integer height) Size get_size()

Get the caret size.

### Caret#get_window

Window get_window()

Get the window the caret is associated with.

### Caret#hide

hide()

Same as Caret::Show.

### Caret#is_ok

Boolean is_ok()

Returns true if the caret was created successfully.

### Caret#is_visible

Boolean is_visible()

Returns true if the caret is visible and false if it is permanently
hidden (if it is is blinking and not shown currently but will be after the
next blink, this method still returns true).

### Caret#move

move(%(arg-type)Integer% x, Integer y) move(%(arg-type)Point% pt)

Move the caret to given position (in logical coordinates).

### Caret#set_blink_time

set_blink_time(%(arg-type)Integer% milliseconds)

Sets the blink time for all the carets.

#### Remarks

Under Windows, this function will change the blink time for all carets
permanently (until the next time it is called), even for the carets in other
applications.

#### See also

get_blink_time

### Caret#set_size

set_size(%(arg-type)Integer% width, Integer height) set_size(%(arg-type)Size% size)

Changes the size of the caret.

### Caret#show

show(%(arg-type)Boolean% show = true)

Shows or hides the caret. Notice that if the caret was hidden $N$ times, it
must be shown $N$ times as well to reappear on the screen.

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