nodesnim/nodescontrol/rich_edit_text

It provides convenient text input. With it, you can set color and underlie for specific chars.

Types

RichEditTextObj = object of ControlPtr
  blit_caret*: bool
  blit_speed*: float
  blit_time*: float
  caret_position*: int
  font*: pointer               ## Glut font data.
  spacing*: float              ## Font spacing.
  size*: float                 ## Font size.
  text*: ColorTextRef
  hint_text*: ColorTextRef
  caret_color*: ColorRef
  text_align*: AnchorRef       ## Text align.
  on_edit*: proc (pressed_key: string): void ## This called when user press any key.
  
RichEditTextPtr = ptr RichEditTextObj

Procs

proc RichEditText(name: string = "RichEditText"): RichEditTextPtr {...}{.raises: [], tags: [].}

Creates a new RichEditText pointer.

Arguments:

  • name is a node name.

Examples:

var text = RichEditText("RichEditText")

Methods

method getTextSize(self: RichEditTextPtr): Vector2Ref {...}{.base, raises: [], tags: [].}
Returns text size.
method getLine(self: RichEditTextPtr): int {...}{.base, raises: [], tags: [].}
Returns current caret line.
method getCharPositionUnderMouse(self: RichEditTextPtr): int {...}{.base, raises: [],
    tags: [].}
Returns char position under mouse.
method getCharUnderMouse(self: RichEditTextPtr): ColorCharRef {...}{.base, raises: [],
    tags: [].}
Returns char under mouse
method getWordPositionUnderMouse(self: RichEditTextPtr): tuple[
    startpos, endpos: int] {...}{.base, raises: [], tags: [].}
Returns words under mouse. Returns (-1, -1), if under mouse no founds words.
method getWordUnderMouse(self: RichEditTextPtr): ColorTextRef {...}{.base, raises: [],
    tags: [].}
Returns words under mouse.
method draw(self: RichEditTextPtr; w, h: GLfloat) {...}{.raises: [GLerror, Exception],
    tags: [RootEffect].}
This uses in the window.nim.
method duplicate(self: RichEditTextPtr): RichEditTextPtr {...}{.base, raises: [], tags: [].}
Duplicates RichEditText and create a new RichEditText pointer.
method handle(self: RichEditTextPtr; event: InputEvent; mouse_on: var NodePtr) {...}{.
    raises: [Exception], tags: [RootEffect].}
Handles user input. This uses in the window.nim.
method setTextAlign(self: RichEditTextPtr; align: AnchorRef) {...}{.base, raises: [],
    tags: [].}
Changes text align.
method setTextAlign(self: RichEditTextPtr; x1, y1, x2, y2: float) {...}{.base, raises: [],
    tags: [].}
Changes text align.
method setText(self: RichEditTextPtr; value: ColorTextRef) {...}{.base, raises: [], tags: [].}
Changes RichEditText text.