Package wx :: Module richtext :: Class RichTextCtrl

[frames | no frames]

## Type RichTextCtrl

    object --+
             |
        Object --+
                 |
        EvtHandler --+
                     |
                Window --+
                         |
                     Panel --+
                             |
                ScrolledWindow --+
                                 |
                                RichTextCtrl

Proxy of C++ RichTextCtrl class

Method Summary
Window | ``__init__`(self, parent, id, pos, size, style, name)` Construct and show a generic Window.
RichTextRange | `AddImage(self, image)`
RichTextRange | `AddParagraph(self, text)`
| ``AppendText`(self, text)` Append text to the end of the document.
bool | `ApplyAlignmentToSelection(self, alignment)`
bool | `ApplyBoldToSelection(self)`
bool | `ApplyItalicToSelection(self)`
bool | `ApplyStyleSheet(self, styleSheet)`
bool | `ApplyUnderlineToSelection(self)`
bool | `BatchingUndo(self)`
bool | `BeginAlignment(self, alignment)`
bool | `BeginBatchUndo(self, cmdName)`
bool | `BeginBold(self)`
bool | `BeginCharacterStyle(self, characterStyle)`
bool | `BeginFont(self, font)`
bool | `BeginFontSize(self, pointSize)`
bool | `BeginItalic(self)`
bool | `BeginLeftIndent(self, leftIndent, leftSubIndent)`
bool | `BeginLineSpacing(self, lineSpacing)`
bool | ``BeginListStyle`(self, listStyle, level, number)` Begin named list style.
bool | `BeginNumberedBullet(self, bulletNumber, leftIndent, leftSubIndent, bulletStyle)`
bool | `BeginParagraphSpacing(self, before, after)`
bool | `BeginParagraphStyle(self, paragraphStyle)`
bool | `BeginRightIndent(self, rightIndent)`
bool | `BeginSuppressUndo(self)`
bool | `BeginSymbolBullet(self, symbol, leftIndent, leftSubIndent, bulletStyle)`
bool | `BeginTextColour(self, colour)`
bool | `BeginUnderline(self)`
bool | ``BeginURL`(self, url, characterStyle)` Begin URL.
bool | ``CanCopy`(self)` Returns `True` if the selection can be copied to the clipboard.
bool | ``CanCut`(self)` Returns `True` if the selection can be cut to the clipboard.
bool | ``CanDeleteSelection`(self)` Returns `True` if the selection can be removed from the document.
bool | ``CanPaste`(self)` Returns `True` if the current contents of the clipboard can be pasted into the document.
bool | ``CanRedo`(self)` Returns `True` if the last operation can be redone.
bool | ``CanUndo`(self)` Returns `True` if the last operation can be undone.
| `Clear(self)`
| ``Copy`(self)` Copies the selected text to the clipboard.
bool | ``Create`(self, parent, id, pos, size, style, name)` Create the GUI part of the Window for 2-phase creation mode.
| ``Cut`(self)` Copies the selected text to the clipboard and removes the selection.
| ``DeleteSelection`(self)` Remove the current selection.
| ``DiscardEdits`(self)` Clears the dirty flag.
bool | `EndAlignment(self)`
bool | `EndAllStyles(self)`
bool | `EndBatchUndo(self)`
bool | `EndBold(self)`
bool | `EndCharacterStyle(self)`
bool | `EndFont(self)`
bool | `EndFontSize(self)`
bool | `EndItalic(self)`
bool | `EndLeftIndent(self)`
bool | `EndLineSpacing(self)`
bool | ``EndListStyle`(self)` End named list style.
bool | `EndNumberedBullet(self)`
bool | `EndParagraphSpacing(self)`
bool | `EndParagraphStyle(self)`
bool | `EndRightIndent(self)`
bool | `EndStyle(self)`
bool | `EndSuppressUndo(self)`
bool | `EndSymbolBullet(self)`
bool | `EndTextColour(self)`
bool | `EndUnderline(self)`
bool | ``EndURL`(self)` End URL.
wxRichTextBuffer | `GetBuffer(self)`
RichTextAttr | ``GetDefaultStyle`(self)` Retrieves a copy of the default style object.
long | ``GetDelayedLayoutThreshold`(self)` Get the threshold in character positions for doing layout optimization during sizing.
String | `GetFilename(self)`
int | ``GetHandlerFlags`(self)` Get the handler flags, controlling loading and saving.
long | ``GetInsertionPoint`(self)` Returns the insertion point.
RichTextRange | `GetInternalSelectionRange(self)`
long | ``GetLastPosition`(self)` Returns the zero based index of the last position in the document.
int | `GetLineLength(self, lineNo)`
String | `GetLineText(self, lineNo)`
int | `GetNumberOfLines(self)`
String | `GetRange(self, from, to)`
| ``GetSelection`(*args, **kwargs)` GetSelection() --> (start, end)
RichTextRange | `GetSelectionRange(self)`
String | `GetStringSelection(self)`
bool | ``GetStyle`(self, position, style)` Retrieve the style used at the given position.
wxRichTextStyleSheet | `GetStyleSheet(self)`
bool | ``GetUncombinedStyle`(self, position, style)` Get the content (uncombined) attributes for this position.
String | `GetValue(self)`
bool | `HasCharacterAttributes(self, range, style)`
bool | `HasParagraphAttributes(self, range, style)`
bool | `HasSelection(self)`
| ``HitTest`(*args, **kwargs)` HitTest(self, Point pt) --> (result, pos)
| ``HitTestXY`(*args, **kwargs)` HitTestRC(self, Point pt) --> (result, col, row)
bool | `IsEditable(self)`
bool | `IsModified(self)`
bool | `IsMultiLine(self)`
bool | `IsSelectionAligned(self, alignment)`
bool | `IsSelectionBold(self)`
bool | `IsSelectionItalics(self)`
bool | `IsSelectionUnderlined(self)`
bool | `IsSingleLine(self)`
bool | `LayoutContent(self, onlyVisibleRect)`
bool | ``LoadFile`(self, file, type)` Load the contents of the document from the given filename.
| ``MarkDirty`(self)` Sets the dirty flag, meaning that the contents of the control have changed and need to be saved.
bool | `MoveCaret(self, pos, showAtLineStart)`
bool | `MoveDown(self, noLines, flags)`
bool | `MoveEnd(self, flags)`
bool | `MoveHome(self, flags)`
bool | `MoveLeft(self, noPositions, flags)`
bool | `MoveRight(self, noPositions, flags)`
bool | `MoveToLineEnd(self, flags)`
bool | `MoveToLineStart(self, flags)`
bool | `MoveToParagraphEnd(self, flags)`
bool | `MoveToParagraphStart(self, flags)`
bool | `MoveUp(self, noLines, flags)`
bool | `Newline(self)`
bool | ``PageDown`(self)` This is just a wrapper for ScrollPages(1).
bool | ``PageUp`(self)` This is just a wrapper for ScrollPages(-1).
| ``Paste`(self)` Pastes text from the clipboard into the document at the current insertion point.
| ``PositionToXY`(*args, **kwargs)` PositionToXY(self, long pos) --> (x, y)
| ``Redo`(self)` If the last operation can be redone, redoes the last operation.
| `Remove(self, from, to)`
| `Replace(self, from, to, value)`
bool | ``SaveFile`(self, file, type)` Save the contents of the document to the given filename, or if the empty string is passed then to the filename set with `SetFilename`.
| ``SelectAll`(self)` Select all text in the document.
| `SelectNone(self)`
bool | `SelectWord(self, position)`
| `SetBasicStyle(self, style)`
bool | ``SetDefaultStyle`(self, style)` Set the style used by default for the rich text document.
bool | `SetDefaultStyleToCursorStyle(self)`
| ``SetDelayedLayoutThreshold`(self, threshold)` Set the threshold in character positions for doing layout optimization during sizing.
| ``SetEditable`(self, editable)` Makes the document editable or read-only, overriding the RE_READONLY flag.
| `SetFilename(self, filename)`
| ``SetHandlerFlags`(self, flags)` Set the handler flags, controlling loading and saving.
| ``SetInsertionPoint`(self, pos)` Sets the insertion point at the given position.
| ``SetInsertionPointEnd`(self)` Moves the insertion point to the end of the document.
| `SetInternalSelectionRange(self, range)`
| ``SetMaxLength`(*args, **kwargs)` SetMaxLength(self, unsigned long len)
| ``SetSelection`(self, from, to)` Selects the text starting at the first position up to (but not including) the character at the last position.
| `SetSelectionRange(self, range)`
bool | ``SetStyle`(self, range, style)` Set the style for the text in `range` to `style`
bool | ``SetStyleEx`(self, range, style, flags)` Extended style setting operation with flags including: RICHTEXT_SETSTYLE_WITH_UNDO, RICHTEXT_SETSTYLE_OPTIMIZE, RICHTEXT_SETSTYLE_PARAGRAPHS_ONLY, RICHTEXT_SETSTYLE_CHARACTERS_ONLY
| `SetStyleSheet(self, styleSheet)`
| `SetValue(self, value)`
| ``ShowPosition`(self, position)` Ensure that the given position in the document is visible.
bool | `SuppressingUndo(self)`
| ``Undo`(self)` If the last operation can be undone, undoes the last operation.
bool | `WordLeft(self, noPages, flags)`
bool | `WordRight(self, noPages, flags)`
bool | `WriteBitmap(self, bitmap, bitmapType)`
bool | `WriteImage(self, image, bitmapType)`
bool | `WriteImageBlock(self, imageBlock)`
bool | `WriteImageFile(self, filename, bitmapType)`
| ``WriteText`(self, text)` Insert text at the current position.
long | ``XYToPosition`(self, x, y)` Translate a col,row coordinants into a document position.

Property Summary
| `Buffer`: See `GetBuffer`
| `DefaultStyle`: See `GetDefaultStyle` and `SetDefaultStyle`
| `DelayedLayoutThreshold`: See `GetDelayedLayoutThreshold` and `SetDelayedLayoutThreshold`
| `Filename`: See `GetFilename` and `SetFilename`
| `InsertionPoint`: See `GetInsertionPoint` and `SetInsertionPoint`
| `InternalSelectionRange`: See `GetInternalSelectionRange` and `SetInternalSelectionRange`
| `LastPosition`: See `GetLastPosition`
| `NumberOfLines`: See `GetNumberOfLines`
| `Selection`: See `GetSelection` and `SetSelection`
| `SelectionRange`: See `GetSelectionRange` and `SetSelectionRange`
| `StringSelection`: See `GetStringSelection`
| `StyleSheet`: See `GetStyleSheet` and `SetStyleSheet`
| `thisown`: The membership flag
| `Value`: See `GetValue` and `SetValue`

Instance Method Details

### __init__(self, parent, id=-1, value=EmptyString, pos=DefaultPosition, size=DefaultSize, style=RE_MULTILINE)
(Constructor)

Construct and show a generic Window.

  Parameters:
    `parent`
    (type=Window)

    `id`
    (type=int)

    `pos`
    (type=Point)

    `size`
    (type=Size)

    `style`
    (type=long)

    `name`
    (type=String)

  Returns:
    Window
  Overrides:
    `wx.ScrolledWindow.__init__` (inherited documentation)

### AppendText(self, text)

Append text to the end of the document.

  Parameters:
    `text`
    (type=String)

### BeginListStyle(self, listStyle, level=1, number=1)

Begin named list style.

  Parameters:
    `listStyle`
    (type=String)

    `level`
    (type=int)

    `number`
    (type=int)

  Returns:
    bool

### BeginURL(self, url, characterStyle=wxEmptyString)

Begin URL.

  Parameters:
    `url`
    (type=String)

    `characterStyle`
    (type=String)

  Returns:
    bool

### CanCopy(self)

Returns `True` if the selection can be copied to the clipboard.

  Returns:
    bool

### CanCut(self)

Returns `True` if the selection can be cut to the clipboard.

  Returns:
    bool

### CanDeleteSelection(self)

Returns `True` if the selection can be removed from the document.

  Returns:
    bool

### CanPaste(self)

Returns `True` if the current contents of the clipboard can be pasted into the document.

  Returns:
    bool

### CanRedo(self)

Returns `True` if the last operation can be redone.

  Returns:
    bool

### CanUndo(self)

Returns `True` if the last operation can be undone.

  Returns:
    bool

### Copy(self)

Copies the selected text to the clipboard.

### Create(self, parent, id=-1, value=EmptyString, pos=DefaultPosition, size=DefaultSize, style=RE_MULTILINE)

Create the GUI part of the Window for 2-phase creation mode.

  Parameters:
    `parent`
    (type=Window)

    `id`
    (type=int)

    `pos`
    (type=Point)

    `size`
    (type=Size)

    `style`
    (type=long)

    `name`
    (type=String)

  Returns:
    bool
  Overrides:
    `wx.ScrolledWindow.Create` (inherited documentation)

### Cut(self)

Copies the selected text to the clipboard and removes the selection.

### DeleteSelection(self)

Remove the current selection.

### DiscardEdits(self)

Clears the dirty flag. :see: `MarkDirty`

### EndListStyle(self)

End named list style.

  Returns:
    bool

### EndURL(self)

End URL.

  Returns:
    bool

### GetDefaultStyle(self)

Retrieves a copy of the default style object.

  Returns:
    RichTextAttr

### GetDelayedLayoutThreshold(self)

Get the threshold in character positions for doing layout optimization during sizing.

  Returns:
    long

### GetHandlerFlags(self)

Get the handler flags, controlling loading and saving.

  Returns:
    int

### GetInsertionPoint(self)

Returns the insertion point. This is defined as the zero based index of the character position to the right of the insertion point.

  Returns:
    long

### GetLastPosition(self)

Returns the zero based index of the last position in the document.

  Returns:
    long

### GetSelection(*args, **kwargs)

GetSelection() --> (start, end)

Returns the start and end positions of the current selection. If the values are the same then there is no selection.

### GetStyle(self, position, style)

Retrieve the style used at the given position. Copies the style values at `position` into the `style` parameter and returns `True` if successful. Returns `False` otherwise.

  Parameters:
    `position`
    (type=long)

    `style`
    (type=RichTextAttr)

  Returns:
    bool

### GetUncombinedStyle(self, position, style)

Get the content (uncombined) attributes for this position. Copies the style values at `position` into the `style` parameter and returns `True` if successful. Returns `False` otherwise.

  Parameters:
    `position`
    (type=long)

    `style`
    (type=RichTextAttr)

  Returns:
    bool

### HitTest(*args, **kwargs)

HitTest(self, Point pt) --> (result, pos)

Returns the character position at the given point in pixels. Note that `pt` should be given in device coordinates, and not be adjusted for the client area origin nor for scrolling. The return value is a tuple of the hit test result and the position.

Possible result values are a bitmask of these flags:

> RICHTEXT_HITTEST_NONE | The point was not on this object.

> RICHTEXT_HITTEST_BEFORE

> The point was before the position
>   returned from HitTest.

> RICHTEXT_HITTEST_AFTER | The point was after the position returned from HitTest.
> RICHTEXT_HITTEST_ON | The point was on the position returned from HitTest

  Overrides:
    `wx.Window.HitTest`

### HitTestXY(*args, **kwargs)

HitTestRC(self, Point pt) --> (result, col, row)

Returns the column and row of the given point in pixels. Note that `pt` should be given in device coordinates, and not be adjusted for the client area origin nor for scrolling. The return value is a tuple of the hit test result and the column and row values. :see: `HitTest`

  Overrides:
    `wx.Window.HitTestXY`

### LoadFile(self, file, type=RICHTEXT_TYPE_ANY)

Load the contents of the document from the given filename.

  Parameters:
    `file`
    (type=String)

    `type`
    (type=int)

  Returns:
    bool

### MarkDirty(self)

Sets the dirty flag, meaning that the contents of the control have changed and need to be saved.

### PageDown(self, noPages=1, flags=0)

This is just a wrapper for ScrollPages(1).

  Returns:
    bool
  Overrides:
    `wx.Window.PageDown` (inherited documentation)

### PageUp(self, noPages=1, flags=0)

This is just a wrapper for ScrollPages(-1).

  Returns:
    bool
  Overrides:
    `wx.Window.PageUp` (inherited documentation)

### Paste(self)

Pastes text from the clipboard into the document at the current insertion point.

### PositionToXY(*args, **kwargs)

PositionToXY(self, long pos) --> (x, y)

Retrieves the col,row for the given position within the document

### Redo(self)

If the last operation can be redone, redoes the last operation.

### SaveFile(self, file=EmptyString, type=RICHTEXT_TYPE_ANY)

Save the contents of the document to the given filename, or if the empty string is passed then to the filename set with `SetFilename`.

  Parameters:
    `file`
    (type=String)

    `type`
    (type=int)

  Returns:
    bool

### SelectAll(self)

Select all text in the document.

### SetDefaultStyle(self, style)

Set the style used by default for the rich text document.

  Parameters:
    `style`
    (type=RichTextAttr)

  Returns:
    bool

### SetDelayedLayoutThreshold(self, threshold)

Set the threshold in character positions for doing layout optimization during sizing.

  Parameters:
    `threshold`
    (type=long)

### SetEditable(self, editable)

Makes the document editable or read-only, overriding the RE_READONLY flag.

  Parameters:
    `editable`
    (type=bool)

### SetHandlerFlags(self, flags)

Set the handler flags, controlling loading and saving.

  Parameters:
    `flags`
    (type=int)

### SetInsertionPoint(self, pos)

Sets the insertion point at the given position.

  Parameters:
    `pos`
    (type=long)

### SetInsertionPointEnd(self)

Moves the insertion point to the end of the document.

### SetMaxLength(*args, **kwargs)

SetMaxLength(self, unsigned long len)

Set the max number of characters which may be entered in a single line text control.

### SetSelection(self, from, to)

Selects the text starting at the first position up to (but not including) the character at the last position. If both parameters are equal to -1 then all text in the control is selected.

  Parameters:
    `from`
    (type=long)

    `to`
    (type=long)

### SetStyle(self, range, style)

Set the style for the text in `range` to `style`

  Parameters:
    `range`
    (type=RichTextRange)

    `style`
    (type=RichTextAttr)

  Returns:
    bool

### SetStyleEx(self, range, style, flags=RICHTEXT_SETSTYLE_WITH_UNDO)

Extended style setting operation with flags including: RICHTEXT_SETSTYLE_WITH_UNDO, RICHTEXT_SETSTYLE_OPTIMIZE, RICHTEXT_SETSTYLE_PARAGRAPHS_ONLY, RICHTEXT_SETSTYLE_CHARACTERS_ONLY

  Parameters:
    `range`
    (type=RichTextRange)

    `style`
    (type=RichTextAttr)

    `flags`
    (type=int)

  Returns:
    bool

### ShowPosition(self, position)

Ensure that the given position in the document is visible.

  Parameters:
    `position`
    (type=long)

### Undo(self)

If the last operation can be undone, undoes the last operation.

### WriteText(self, text)

Insert text at the current position.

  Parameters:
    `text`
    (type=String)

### XYToPosition(self, x, y)

Translate a col,row coordinants into a document position.

  Parameters:
    `x`
    (type=long)

    `y`
    (type=long)

  Returns:
    long

Property Details

### Buffer

See `GetBuffer`

  Get Method:
    `GetBuffer`(self)

### DefaultStyle

See `GetDefaultStyle` and `SetDefaultStyle`

  Get Method:
    `GetDefaultStyle`(self)
  Set Method:
    `SetDefaultStyle`(self, style)

### DelayedLayoutThreshold

See `GetDelayedLayoutThreshold` and `SetDelayedLayoutThreshold`

  Get Method:
    `GetDelayedLayoutThreshold`(self)
  Set Method:
    `SetDelayedLayoutThreshold`(self, threshold)

### Filename

See `GetFilename` and `SetFilename`

  Get Method:
    `GetFilename`(self)
  Set Method:
    `SetFilename`(self, filename)

### InsertionPoint

See `GetInsertionPoint` and `SetInsertionPoint`

  Get Method:
    `GetInsertionPoint`(self)
  Set Method:
    `SetInsertionPoint`(self, pos)

### InternalSelectionRange

See `GetInternalSelectionRange` and `SetInternalSelectionRange`

  Get Method:
    `GetInternalSelectionRange`(self)
  Set Method:
    `SetInternalSelectionRange`(self, range)

### LastPosition

See `GetLastPosition`

  Get Method:
    `GetLastPosition`(self)

### NumberOfLines

See `GetNumberOfLines`

  Get Method:
    `GetNumberOfLines`(self)

### Selection

See `GetSelection` and `SetSelection`

  Get Method:
    `GetSelection`(*args, **kwargs)
  Set Method:
    `SetSelectionRange`(self, range)

### SelectionRange

See `GetSelectionRange` and `SetSelectionRange`

  Get Method:
    `GetSelectionRange`(self)
  Set Method:
    `SetSelectionRange`(self, range)

### StringSelection

See `GetStringSelection`

  Get Method:
    `GetStringSelection`(self)

### StyleSheet

See `GetStyleSheet` and `SetStyleSheet`

  Get Method:
    `GetStyleSheet`(self)
  Set Method:
    `SetStyleSheet`(self, styleSheet)

### thisown

The membership flag

  Get Method:
    unknown--1272704196(...)
  Set Method:
    unknown--1272704140(...)

### Value

See `GetValue` and `SetValue`

  Get Method:
    `GetValue`(self)
  Set Method:
    `SetValue`(self, value)

Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:12:37 2007 | http://epydoc.sf.net