|
|
On 11/26/20 5:18 PM Greg Ercolano wrote:
[...]
would it make sense to add a method to Fl_Group, e.g. relative(bool) that allows child widgets
to be positioned relative to the upper/left corner of the group rather than the parent window?
[...]
Anyway, just a thought -- I'm not sure this would work and haven't tried any tests, just curious
if this sounds plausible/useful, or is just an unwanted can of worms or a malformed idea..
Here's a thought that *could* work: long ago I created a commercial
application that used group relative coordinates in its own
window/group/widget definition syntax. These internal group relative
coordinates wer transformed to FLTK window relative coordinates when the
widgets were created.
What we could do is a similar approach: we could use a flag that lets
the user create a widget with group relative coordinates and we could
transform the widget coordinates to window relative coordinates when the
widget is add()ed to the group. This flag could either be global or used
in a modified Fl_Group::add() method.
Example:
Fl_Group::add_relative(1); // set relative coordinates
Fl_Window *win = new Fl_Window(600, 400);
Fl_Group *grp = new Fl_Group(100, 100, 200, 200); // (100, 100)
Fl_Input *inp = new Fl_Input(20, 30, 100, 30); // 120, 130
Adding the Fl_Input to the group at (100, 100) with relative coordinates
(20, 30) would transform the coordinates to (100+20, 100+30) when the
widget gets added to the group.
The good thing is that this would only need changes to Fl_Group::add()
and similar (Fl_Group) methods but no changes to drawing and event
delivery and it would be entirely optional (applicable per widget /
group if necessary).
Might be worth some further investigations...
--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/76de2cae-d152-8820-442e-ef2ee1ec2130%40online.de.
[ Direct Link to Message ] | |
|
| |