Boost logo

Boost :

From: Brock Peabody (brock.peabody_at_[hidden])
Date: 2003-08-06 15:28:19


Because for a pretty large number of applications you can really
simplify your code a lot by relying on the GUI system to 'do the right
thing':

   using boost::gui;

   void my_action() {...}
   void progress_action(int tick) {...}

   gui::show( "sample boost application",
              column ( button ("click it", &my_action),
                       progress (100, &progress_action)));

There are a lot of good reasons why we would not always want to have
total control. I want my applications to be as simple as possible, and
to all look the same. If the GUI library picks the 'best' settings for
the platform automatically, the individual programmer doesn't have to
think about it. Everything just works like it should. To take a few
things from your snippet that are suspect to me:

> w.width( 400 );
> w.height( 200 )

Where do 400 and 200 come from? This seems arbitrary to me. The GUI
system should be able to tell how to size itself.

> b.align( alignment::vcenter | alignment::hcenter );

A real world application needs much more sophisticated positioning
mechanisms than this. The tiny snippet above (in my code) hides some
pretty good positioning logic.

> pb.min( 0 );
> pb.max( 100 );
> pb.step( 5 );
> pb.smooth( true );

Again, these values should be picked automatically.

Now, it might be cool to be able to change my above code to:

      gui::show<my_company_gui_traits>( "sample boost application",
         ...

Where you can have specified such things as whether or not your progress
bars are smooth and what the step size is. Maybe you could even do it
at run-time.

      get_my_company_gui_traits().show("sample boost application",
         ...

My motivation for the design of this again:

- GUI code is difficult, tedious, and error prone even for simple tasks,
I want to make it simple (for simple tasks)

- control positioning is especially difficult

- Consistency in GUI applications is difficult. Give ten programmers a
lower level GUI API and they'll turn out ten applications each with a
different look and feel. I don't want to have to remember that step
size for our company is always '5', for instance.

If we head in the direction we've been talking we would also provide a
cross platform lower level API where you could get more control and do
things like what you describe below. I hope that most programmers would
find it unnecessary though.

> -----Original Message-----
> From: boost-bounces_at_[hidden]
[mailto:boost-bounces_at_[hidden]]
> On Behalf Of Bohdan
> Sent: Wednesday, August 06, 2003 2:31 PM
> To: boost_at_[hidden]
> Subject: [boost] GUI sublanguage ?
>
> Recently there was idea about "spirit-like" dialog sublanguage
> implemented in c++. I still can't get why someone may need
> it ?
> Spirit is forced to use such language to build QUOTED code, which
> works only when parsing occur. In case of GUI lib
> sutiation is different :
> We are not building code, but tree of gui objects placed in
> 2d (+z order). Sure boost::gui should deal with actions,
> but generally they are much more compicated than spirit ones
> and can't be easyly implemented by binders/bll/phoenix.
> Besides, average gui control has a lot of properties which
> may change in runtime. Would be convenient and
> effective to fill/change such properties using spirit like
> language ?
>
> Why invent new shape for wheel ? :
>
> void my_action( component & sender )
> {
> show_dialog( "sender is " + sender.title() );
> }
>
> main()
> {
> window w;
> w.title("sample boost application");
> w.width( 400 );
> w.height( 200 )
>
> button b;
> b.title("click it!");
> b.on_click.connect( &my_action );
> w.insert( b );
> b.align( alignment::vcenter | alignment::hcenter );
>
> progress_bar pb;
> pb.align( alignment::bottom );
> pb.min( 0 );
> pb.max( 100 );
> pb.step( 5 );
> pb.smooth( true );
> w.insert( pb );
>
> w.show(); //or w.show_modal();
>
> window::main_loop();
> }
>
> regards,
> bohdan
>
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk