Why FLTK window become unresizable with mouse after resize() was called?

StackOverflow https://stackoverflow.com/questions/21170098

  •  28-09-2022
  •  | 
  •  

質問

Why I cannot resize the window once window.size() or window.resize() was called? How to fix this?

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
int main(int argc, char** argv) {
  Fl_Window window(0, 0, 110, 110);
  window.position(0, 0);
//  window.size(300, 300); <--uncomment this, and cannot resize window with the mouse!
  window.show(argc,argv);
  return Fl::run();
}
 
役に立ちましたか?

解決

size(width, height) is basically a shortcut to resize(x(), y(), width, height). It fixes the size of the widget.

If you want the window to be resizable, call

window.resizable(&window);

Have a look at subwindow.cxx in the test programs from the distribution tarball.

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