DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2221
Version: 1.3-feature





Link: http://www.fltk.org/str.php?L2221
Version: 1.3-feature
#include <stdio.h>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Menu_Bar.H>
#include <FL/Fl_Scroll.H>

void alt_cb(Fl_Widget*, void*) {printf("hello Alt-key\n");}

Fl_Menu_Item menutable[] = {
  {"File",0,0,0,FL_SUBMENU},
    {"Open",    FL_ALT+'o', alt_cb, 0},
    {"Close",   0,      0},
    {0},
  {"Edit",FL_F+2,0,0,FL_SUBMENU},
    {"Undo",    0,      0},
    {0},
  {0}
};

int main(int argc, char **argv)
{
  int BH = 20;
  int MH = BH + 6;
  int NB = 2;
  int width = 14 * FL_NORMAL_SIZE;
  
  Fl_Window *win = new Fl_Window(width, MH + NB * BH, "Test");
  Fl_Menu_Bar *menu = new Fl_Menu_Bar(0, 0, width, MH);
  menu->menu(menutable);
  Fl_Scroll *scroll = new Fl_Scroll(0, MH, width, NB * BH); 
  scroll->type(Fl_Scroll::VERTICAL);
  scroll->end();

  win->size(width, MH);
  win->end();
  win->show(argc, argv);

  // uncomment this: the new size is wrong (and the menu is broken)
  //win->size(width, MH + NB * BH);

  return Fl::run();
}
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to