Search documentation of wx

# View Source wxCaret (wx v2.4.3)

A caret is a blinking cursor showing the position where the typed text will appear.

Text controls usually have their own caret but `wxCaret` provides a way 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 `wxWindow:getCaret/1`. The same caret can't be reused in two different windows.

wxWidgets docs: wxCaret

# Summary

## Types

wxCaret()

## Functions

create(This, Window, Size)
create(This, Window, Width, Height)

Creates a caret with the given size (in pixels) and associates it with the `window` (same as the equivalent constructors).

destroy(This)

Destroys the object

getBlinkTime()

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).

getPosition(This)
getSize(This)
getWindow(This)

Get the window the caret is associated with.

hide(This)

Hides the caret, same as Show(false).

isOk(This)

Returns true if the caret was created successfully.

isVisible(This)

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

move(This, Pt)
move(This, X, Y)

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

new(Window, Size)
new(Window, Width, Height)

Creates a caret with the given size (in pixels) and associates it with the `window`.

setBlinkTime(Milliseconds)

Sets the blink time for all the carets.

setSize(This, Size)
setSize(This, Width, Height)

Changes the size of the caret.

show(This)

Equivalent to `show(This, [])`.

show/2

Shows or hides the caret.

# Types

Link to this type

# wxCaret()

View Source

    -type wxCaret() :: wx:wx_object().

# Functions

Link to this function

# create(This, Window, Size)

View Source

    -spec create(This, Window, Size) -> boolean()
                    when
                        This :: wxCaret(),
                        Window :: wxWindow:wxWindow(),
                        Size :: {W :: integer(), H :: integer()}.

Link to this function

# create(This, Window, Width, Height)

View Source

    -spec create(This, Window, Width, Height) -> boolean()
                    when
                        This :: wxCaret(),
                        Window :: wxWindow:wxWindow(),
                        Width :: integer(),
                        Height :: integer().

Creates a caret with the given size (in pixels) and associates it with the `window` (same as the equivalent constructors).

Link to this function

# destroy(This)

View Source

    -spec destroy(This :: wxCaret()) -> ok.

Destroys the object

Link to this function

# getBlinkTime()

View Source

    -spec getBlinkTime() -> integer().

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).

Link to this function

# getPosition(This)

View Source

    -spec getPosition(This) -> {X :: integer(), Y :: integer()} when This :: wxCaret().

Link to this function

# getSize(This)

View Source

    -spec getSize(This) -> {W :: integer(), H :: integer()} when This :: wxCaret().

Link to this function

# getWindow(This)

View Source

    -spec getWindow(This) -> wxWindow:wxWindow() when This :: wxCaret().

Get the window the caret is associated with.

Link to this function

# hide(This)

View Source

    -spec hide(This) -> ok when This :: wxCaret().

Hides the caret, same as Show(false).

Link to this function

# isOk(This)

View Source

    -spec isOk(This) -> boolean() when This :: wxCaret().

Returns true if the caret was created successfully.

Link to this function

# isVisible(This)

View Source

    -spec isVisible(This) -> boolean() when This :: wxCaret().

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

Link to this function

# move(This, Pt)

View Source

    -spec move(This, Pt) -> ok when This :: wxCaret(), Pt :: {X :: integer(), Y :: integer()}.

Link to this function

# move(This, X, Y)

View Source

    -spec move(This, X, Y) -> ok when This :: wxCaret(), X :: integer(), Y :: integer().

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

Link to this function

# new(Window, Size)

View Source

    -spec new(Window, Size) -> wxCaret()
                 when Window :: wxWindow:wxWindow(), Size :: {W :: integer(), H :: integer()}.

Link to this function

# new(Window, Width, Height)

View Source

    -spec new(Window, Width, Height) -> wxCaret()
                 when Window :: wxWindow:wxWindow(), Width :: integer(), Height :: integer().

Creates a caret with the given size (in pixels) and associates it with the `window`.

Link to this function

# setBlinkTime(Milliseconds)

View Source

    -spec setBlinkTime(Milliseconds) -> ok when Milliseconds :: integer().

Sets the blink time for all the carets.

Warning:

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

See: `getBlinkTime/0`

Link to this function

# setSize(This, Size)

View Source

    -spec setSize(This, Size) -> ok when This :: wxCaret(), Size :: {W :: integer(), H :: integer()}.

Link to this function

# setSize(This, Width, Height)

View Source

    -spec setSize(This, Width, Height) -> ok when This :: wxCaret(), Width :: integer(), Height :: integer().

Changes the size of the caret.

Link to this function

# show(This)

View Source

    -spec show(This) -> ok when This :: wxCaret().

Equivalent to `show(This, [])`.

Link to this function

# show/2

View Source

    -spec show(This, [Option]) -> ok when This :: wxCaret(), Option :: {show, boolean()}.

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.