Documentation

  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  ]
 

class Fl_Text_Editor


Class Hierarchy

Include Files

    #include <FL/Fl_Text_Editor.H>
    

Description

This is the FLTK text editor widget. It allows the user to edit multiple lines of text and supports highlighting and scrolling. The buffer that is displayed in the widget is managed by the Fl_Text_Buffer class.

Methods

Fl_Text_Editor(int X, int Y, int W, int H, const char* l = 0);

The constructor creates a new text editor widget.

~Fl_Text_Editor();

The destructor frees all memory used by the text editor widget.

void add_default_key_bindings(Key_Binding** list);

Adds all of the default editor key bindings to the specified key binding list.

void add_key_binding(int key, int state, Key_Func f, Key_Binding** list);
void add_key_binding(int key, int state, Key_Func f);

Adds a single key binding to the specified or current key binding list.

Key_Func bound_key_function(int key, int state, Key_Binding* list);
Key_Func bound_key_function(int key, int state);

Returns the function associated with a key binding.

void default_key_function(Key_Func f);

Sets the default key function for unassigned keys.

void insert_mode(int b);
int insert_mode();

Sets or gets the current insert mode; if non-zero, new text is inserted before the current cursor position. Otherwise, new text replaces text at the current cursor position.

int kf_backspace(int c, Fl_Text_Editor* e);

Does a backspace in the current buffer.

int kf_copy(int c, Fl_Text_Editor* e);

Does a copy of selected text in the current buffer.

int kf_c_s_move(int c, Fl_Text_Editor* e);

Extends the current selection in the direction indicated by control key c.

int kf_ctrl_move(int c, Fl_Text_Editor* e);

Moves the current text cursor in the direction indicated by control key c.

int kf_cut(int c, Fl_Text_Editor* e);

Does a cut of selected text in the current buffer.

int kf_default(int c, Fl_Text_Editor* e);

Inserts the text associated with the key c.

int kf_delete(int c, Fl_Text_Editor* e);

Does a delete of selected text or the current character in the current buffer.

int kf_down(int c, Fl_Text_Editor* e);

Moves the text cursor down one line.

int kf_end(int c, Fl_Text_Editor* e);

Moves the text cursor to the end of the current line.

int kf_enter(int c, Fl_Text_Editor* e);

Inserts a newline at the current cursor position.

int kf_home(int c, Fl_Text_Editor* e);

Moves the text cursor to the beginning of the current line.

int kf_ignore(int c, Fl_Text_Editor* e);

Ignores the keypress.

int kf_insert(int c, Fl_Text_Editor* e);

Toggles the insert mode in the text editor.

int kf_left(int c, Fl_Text_Editor* e);

Moves the text cursor to the left in the buffer.

int kf_move(int c, Fl_Text_Editor* e);

Moves the text cursor in the direction indicated by key c.

int kf_page_down(int c, Fl_Text_Editor* e);

Moves the text cursor down one page.

int kf_page_up(int c, Fl_Text_Editor* e);

Moves the text cursor up one page.

int kf_paste(int c, Fl_Text_Editor* e);

Pastes the contents of the clipboard at the current text cursor position.

int kf_right(int c, Fl_Text_Editor* e);

Moves the text cursor one character to the right.

int kf_select_all(int c, Fl_Text_Editor* e);

Selects all text in the buffer.

int kf_shift_move(int c, Fl_Text_Editor* e);

Extends the current selection in the direction of key c.

int kf_up(int c, Fl_Text_Editor* e);

Moves the text cursor up one line.

void remove_all_key_bindings(Key_Binding** list);
void remove_all_key_bindings();

Removes all of the key bindings associated with the text editor or list.

void remove_key_binding(int key, int state, Key_Binding** list);
void remove_key_binding(int key, int state);

Removes a single key binding from the text editor or list.


User Comments [ Add Comment ]

From mariwan, 04:27 Jul 08, 2005 (score=3)

To make the cursor blinks: try this code
*****************************************************************start
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Text_Buffer.H>
#include <FL/Fl_Text_Editor.H>

Fl_Text_Editor *txtedit;

class text: public Fl_Text_Editor { public: text(int x,int y,int w,int h,char *l ); };

int getSetOrNot=0;

void SetCurser(void*) {
    getSetOrNot=!getSetOrNot;
    txtedit->show_cursor(getSetOrNot);
    Fl::repeat_timeout(0.5,SetCurser); }

int main (int argc, char *argv[]) {
    Fl_Window *
window;
    Fl_Text_Editor *t;
    Fl_Text_Buffer *
b;
    b=new Fl_Text_Buffer;
    window = new Fl_Window (10, 10,400,300,"Hello Text Editor");
    getSetOrNot=1;
    t = new Fl_Text_Editor (11, 20, 380, 280, "See Me");
    txtedit=t;
    t->buffer(b);
    Fl::add_timeout(0.5,SetCurser);
    t->box (FL_UP_BOX);
    window->end ();
    window->show (argc, argv);

    return Fl::run(); }
*****************************************************************End
Reply ]

From thomas, 10:21 Feb 19, 2004 (score=2)

Don't try to change the used Buffer twice. like:
  Fl_Text_Buffer* fl_text = new Fl_Text_Buffer(10000);
  out_description->buffer(fl_text);
  //change fl_text
  ...
  out_description->buffer(fl_text); // Here it hangs at runtime

Why I try that? The Update of the edit windows is done automatic, but I don't know it.
Reply ]

 
 

Comments are owned by the poster. All other content is copyright 1998-2015 by Bill Spitzak and others. This project is hosted by Seriss Corporation. Please report site problems to 'erco@seriss.com'.