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=0;

void change_text(Button *w, long arg) {
  static int count = 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 */

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

Reply via email to