質問

Fl_Window *win = new Fl_Window(width, height, "title");
b1 = new Fl_Button(0, 0, 120, 30);
win->end();
b2 = new Fl_Button(130, 0, 120, 30);
win->show();//argc,argv);
Fl::run();

Here, second button b2 will not be shown, because after the call to end(), it is inserted into somewhere else not into win. After browsing through official docs and googling I still cannot understand the idea behind it, and how am I supposed to insert a new button into the window that is not currently selected for insertion? Is there something like win->begin() ?

By the way FLTK docs are rather a machine generated reference, very inconvenient for a learner, any good unofficial resource known?

役に立ちましたか?

解決

Widgets can be added either between begin() and end() or using add.

Fl_Window *win = new Fl_Window(width, height, "title");
win->begin();
b1 = new Fl_Button(0, 0, 120, 30);
win->end();
b2 = new Fl_Button(130, 0, 120, 30);
win->add(b2)

The FLTK docs are generated by doxygen so basically they are only as good as the comments in the code (which is not bad for doxygened documentation). You'll get the same problem with code documented with javadocs and the C# autogenerated XML documentation.

Have you had a look at http://seriss.com/people/erco/fltk/ and http://seriss.com/people/erco/fltk-videos/ . They are the official "helper" web pages. I learnt a lot just by looking at the cheat sheet and examples in the distribution tarball test directory.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top