add:resizable

This commit is contained in:
taynpg 2025-03-19 23:50:09 +08:00
parent 8e9429f349
commit 63015dea50

View File

@ -1,5 +1,6 @@
#include <FL/Fl.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Pack.H>
#include <FL/Fl_Window.H>
@ -40,7 +41,26 @@ int demo1(int argc, char** argv)
return Fl::run();
}
int demo2()
{
auto* dialog = new Fl_Window(300, 100);
auto* icon = new Fl_Box(0, 0, 50, 50, "!");
auto* text = new Fl_Box(50, 0, 250, 40, "Out of Memory Error");
auto* btns = new Fl_Group(50, 50, 250, 50); // parent group
auto* darn = new Fl_Button(200, 50, 100, 50, "Darn!");
auto* R = new Fl_Box(50, 50, 150, 50); // "invisible" box "R"
R->hide(); // make sure it's invisible
btns->resizable(R); // make "R" parent group resizable
btns->end();
dialog->resizable(darn);
dialog->end();
dialog->show();
// 运行事件循环
return Fl::run();
}
int main(int argc, char** argv)
{
demo1(argc, argv);
// demo1(argc, argv);
demo2();
}