>
> Coffee break demo:
>
> Here's what I think is the simplest way to display a list of words in
> fltk2.
>
> This seems to work OK - any use?
>
> (Note: probably get horribly mangled by the email process as I'm using
> Outlook here...)
>
> ---------------------------------------------
> #include <fltk/Window.h>
> #include <fltk/Browser.h>
> #include <fltk/Button.h>
> #include <fltk/run.h>
>
> #include <stdio.h>
> #include <stdlib.h>
>
> using namespace fltk;
>
> Browser *browser=3D0;
>
> void change_text(Button *w, long arg) {
> static int count =3D 124;
> browser->clear();
> for(int idx = 0; idx < 123; idx++){
> char text[32];
> sprintf(text, "Text Line %d", count);
> count++;
> browser->add(text);
> }
> }
>
> int main(int argc,char** argv) {
>
> Window win(280, 340, "Browser Example");
> win.begin();
>
> Button change_button(5, 305, 60, 30, "Change");
> change_button.callback((Callback*)change_text);
>
> browser = new Browser(5, 5, 260, 295);
>
> for(int idx = 0; idx < 123; idx++){
> char text[32];
> sprintf(text, "Text Line %d", idx+1);
> browser->add(text);
> }
> browser->end();
>
> win.resizable(browser);
> win.end();
> win.show(argc,argv);
>
> fltk::run();
> return 0;
> }
>
> /* end of file */
It looks pretty good - i wont be able to run it until ~1900 ADST though.
Although you'd think it intuitive to use a TextDisplay to ... display...
text....
I'll probably go with the browser though.
Do you have any ideas why the original code snippet doesnt work?
I originally thought it to be a bug with the text(const char*) method, but when
using a hardcoded string there's no problem.
I dont *think* it's an issue with the free(), because i've also tried to use it
without that and that hasnt worked either.
I'm using the current (r970) SVN release and i've tested that snippet of code
on both my Windows XP vbox and my Linux box and it's generated the same
problems, which is just incredibly strange, imo.
Thanks for the help though; it wouldnt have occurred to me to use a Browser.
I'll give it a shot when i'm back on a computer i can compile on and see where
it leads.
Cheers,
Ben
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk