When using widget_class, in containing window or Fl_Group, we put a Fl_Box as placeholder with a xywh.
And for the widget_class current fluid generates xywh, but when the width and height is bigger than Fl_Box's width and height, there is no auto-rescaling. then event like click outside Fl_Box's xywh get lost.
fluid currently has the reposition choice but which only handles xy of given xwyh, there is not rescaling to handle ``wh``` part.
This PR changes the Relative button into a choice with three option: None/Relative/Relative & Rescale.
When choose None or Relative, everything is same with previous version, but when choice Relative & Rescale, the generated code will hand the rescaling issue.
take following widget_class as example:
code generated with reposition, but no rescaling:
QD_CondChecker_hasItem::QD_CondChecker_hasItem(int X, int Y, int W, int H, constchar *L)
: Fl_Group(0, 0, W, H, L) {
{ Fl_Box* o = newFl_Box(0, 0, 115, 25, "Has");
o->align(Fl_Align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE));
} // Fl_Box* o
{ m_input = newFl_Value_Input(115, 0, 45, 25);
m_input->labeltype(FL_NO_LABEL);
} // Fl_Value_Input* m_input
{ Fl_Box* o = newFl_Box(160, 0, 50, 25, "Item");
o->align(Fl_Align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE));
} // Fl_Box* o
{ Fl_Choice* o = newFl_Choice(210, 0, 145, 25);
o->down_box(FL_BORDER_BOX);
o->labeltype(FL_NO_LABEL);
o->menu(menu_);
} // Fl_Choice* oposition(X, Y);
end();
resizable(this);
}
code generated with rescaling:
QD_CondChecker_hasItem::QD_CondChecker_hasItem(int X, int Y, int W, int H, constchar *L) :
Fl_Group(0, 0, W, H, L)
{
{ Fl_Box* o = newFl_Box(round(W*0.000000), round(H*0.000000), round(W*0.323944), round(H*1.000000), "Has");
o->align(Fl_Align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE));
} // Fl_Box* o
{ m_input = newFl_Value_Input(round(W*0.323944), round(H*0.000000), round(W*0.126761), round(H*1.000000));
m_input->labeltype(FL_NO_LABEL);
} // Fl_Value_Input* m_input
{ Fl_Box* o = newFl_Box(round(W*0.450704), round(H*0.000000), round(W*0.140845), round(H*1.000000), "Item");
o->align(Fl_Align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE));
} // Fl_Box* o
{ Fl_Choice* o = newFl_Choice(round(W*0.591549), round(H*0.000000), round(W*0.408451), round(H*1.000000));
o->down_box(FL_BORDER_BOX);
o->labeltype(FL_NO_LABEL);
o->menu(menu_);
} // Fl_Choice* oposition(X, Y);
end();
resizable(this);
}
I use this change in my daily work, should be safe as a PR.
You can view, comment on, or merge this pull request online at:
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: <fltk/fltk/pull/481@github.com>
Comments are owned by the poster. All other content is copyright 1998-2025 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.