none wrote:
>
> #define with(group) int
> group##once=1;for((group)->begin();group##once--;(group)->end())
>
>
> which would allow smthng like this (also showing the scope and hirachy
> of added widgets):
>
> Group *g3 = new Group(0, window->h()-THEIGHT
> , window->w(), THEIGHT);
> with(g3)
> {
> char *txt="status bar status bar status bar status bar";
> StatusBarGroup *status = new StatusBarGroup(THEIGHT);
> status->set(txt,StatusBarGroup::SBAR_LEFT);
> status->box(FLAT_BOX);
> //...
> }
> window->resizable(splitter);
> }
>
> just my 2ct, begin/end is a little like pascal and there is no need to
> ident the inner block. thats the advantage of the with macro (besides
> some disadvantages)
Cool. You've demonstrated Ruby Blocks in C++.
How about creating a simple class:
class bend {
widget* _w;
public:
bend( widget* w ) : _w( w ) { _w->begin(); };
~bend() { _w->end(); };
}; // end bend
...;
widget* s = new widget( ... );
...;
{
bend b( s );
new control1( ... );
new control2( ... );
new control3( ... );
};
...;
-Daniel
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk