/*
Tea time demo:

Here's what I think is the simplest way to display a list of words in
fltk2 using TextDisplay. TextDisplay has selection and does copy
to clipboard with Ctrl-C.

build with: fltk2-config --compile textlist.cxx
---------------------------------------------
*/
#include <fltk/Window.h>
#include <fltk/TextDisplay.h>
#include <fltk/Button.h>
#include <fltk/run.h>

#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

using namespace fltk;

TextDisplay *text=0;

void change_text(Button*, long)
        {
        static int count = 0;
        text->buffer()->remove(0,INT_MAX);
        for (int idx = 0; idx < 123; idx++)
                {
                char line[32];
                sprintf(line, "Text Line %d\n", count++);
                text->append(line);
                }
        }

int main(int argc,char** argv)
        {
        Window win(280, 340, "TextDisplay Example");
        win.begin();
                Button change_button(5, 305, 60, 30, "Change");
                change_button.callback((Callback*)change_text);
                text = new TextDisplay(5, 5, 260, 295);
        win.end();
        win.resizable(text);
        change_text(0,0);
        win.show(argc,argv);
        return fltk::run();
        }

/* end of file */
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to