On Sep 6, 2007, at 4:44 PM, goeb wrote: > hello, > > I am wondering if there is a way to known what size takes a group of > widgets. In other words: the smallest rectangle which contains them > all, > including their labels. > > This would be useful to automatically set a frame or resize a > container > around a group of widgets after they have been created. > > If this is not possible for a group of widgets, is it possible for > a single > widget: get the rectangular size of the widget and its label ?
You can get the size of a widget using x(), y(), w(), and h(). To get the size of a label you can call myWidget->measure_label(w, h), where w and h must be defined as integers. w must also be set to the maximum label width, which depends on the alignment flags (if you align inside and enable word wrap, w should be the width of the widget). When the function returns, w and h will contain the size of the smallest box around the label. Now as a last task, you must decide how to add the label size to the widget size, depending on the alignment you choose. If you aligned at the top left, you must subtract the label height from the widgets y and add it to the widget height, etc. . Now to do this for a whole group is easy. Get the bounding box of the first widget in a group (child(0)) and then do a min/max test for all further widgets... . Matthias ---- http://robowerk.com/ _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

