> Thank you, but could not give the example please. OK, I'll attach a fltk-1 version below, as that's what I have to hand. For a fltk-2 version you'll need to port this example across, or get someone else to do your homework! Or just use fltk-1.3 with the example below.
> And this > example it is necessary to add in following version. I do Not > know, on my FLTK2 works fine. Where possible learn of bugs in > versions 2? All the bugs on the various versions are in the roadmap: http://www.fltk.org/roadmap.php#2.0 #include <stdlib.h> #include <stdio.h> #include <string.h> #include <FL/Fl.H> #include <FL/Fl_Double_Window.H> #include <FL/Fl_Group.H> #include <FL/Fl_Tabs.H> #include <FL/Fl_Text_Editor.H> #include <FL/Fl_Button.H> static Fl_Double_Window *main_win = NULL; static Fl_Tabs *edit_tabs = NULL; static int buf_idx = 0; // Style table Fl_Text_Editor::Style_Table_Entry styler[] = { // FONT COLOR FONT FACE FONT SIZE // --------------- ----------- -------------- { FL_RED, FL_COURIER, 18 }, // A - Red { FL_DARK_YELLOW, FL_COURIER, 18 }, // B - Yellow { FL_DARK_GREEN, FL_COURIER, 18 }, // C - Green { FL_BLUE, FL_COURIER, 18 }, // D - Blue }; static int styler_size = sizeof(styler)/sizeof(styler[0]); static void add_editor(void) { int xo = edit_tabs->x(); int yo = edit_tabs->y() + 20; // space for tab at top of view int wo = edit_tabs->w(); int ho = edit_tabs->h() - 20; char lbl[24], *tab_name; buf_idx += 1; // how many buffers? snprintf(lbl, 24, "Edit %d", buf_idx); tab_name = new char(strlen(lbl) + 1); strcpy(tab_name, lbl); // create editor group to go into tab Fl_Group *tab_grp = new Fl_Group(xo, yo, wo, ho, tab_name); tab_grp->begin(); Fl_Text_Editor *disp = new Fl_Text_Editor(xo, yo, wo, ho); Fl_Text_Buffer *tbuff = new Fl_Text_Buffer(); // text buffer Fl_Text_Buffer *sbuff = new Fl_Text_Buffer(); // style buffer tab_grp->end(); // set text buffer up in editor disp->buffer(tbuff); disp->highlight_data(sbuff, styler, styler_size, 'A', 0, 0); // Text tbuff->text("Red Line 1\nYel Line 2\nGrn Line 3\nBlu Line 4\n"); // Style for text sbuff->text("AAAAAAAAAA\nBBBBBBBBBB\nCCCCCCCCCC\nDDDDDDDDDD\n"); // Add to tabs edit_tabs->add(tab_grp); } static void cb_add_bt(Fl_Widget*, void*) { add_editor(); main_win->redraw(); } int main(int argc, char **argv) { main_win = new Fl_Double_Window(640, 510); edit_tabs = new Fl_Tabs(5, 5, 630, 470); edit_tabs->end(); Fl_Button *add_bt = new Fl_Button(5, 480, 50, 30, "Add"); add_bt->callback(cb_add_bt); main_win->end(); add_editor(); // first tab entry main_win->show(argc, argv); return Fl::run(); } /* end of file */ SELEX Galileo Ltd Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL A company registered in England & Wales. Company no. 02426132 ******************************************************************** This email and any attachments are confidential to the intended recipient and may also be privileged. If you are not the intended recipient please delete it from your system and notify the sender. You should not copy it or use it for any purpose nor disclose or distribute its contents to any other person. ******************************************************************** _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

