Boost logo

Boost :

From: Brock Peabody (brock.peabody_at_[hidden])
Date: 2003-07-28 20:11:42


Brock Peabody
Software Development Manager
NPC International

> -----Original Message-----
> From: boost-bounces_at_[hidden]
[mailto:boost-bounces_at_[hidden]]
> On Behalf Of Rob & Lori
> Sent: Monday, July 28, 2003 5:56 PM
> To: 'Boost mailing list'
> Subject: RE: [boost] GUI/GDI template library
>
> > -----Original Message-----
> > From: boost-bounces_at_[hidden]
> > [mailto:boost-bounces_at_[hidden]]On Behalf Of Brock Peabody
> > Sent: Monday, July 28, 2003 9:16 AM
> > To: 'Boost mailing list'
> > Subject: RE: [boost] GUI/GDI template library
> >
> >
> > It wasn't a great leap to progress further to:
> >
> > typedef boost::mpl::vector_c<char,
> >
> > '0','0','0','-','0','0','0','0','0','0'>
> > ssn_mask;
> >
> > gui_manager<employee> gui =
> >
> > column( row("ssn: ", masked_edit<ssn_mask>(&employee::ssn),
> >
> > row("job", combo(make_job_code_map(),
> > &employee::job_code)),
> >
> > column("name: ", edit(&employee::name)));
> >
> > employee e = get_employee();
> >
> > gui.set(e);
> >
> > gui.set_on_change(some_function);
> >
> >

[...]
>
> I'd think making the GUI controls use Boost's Regex++ for text
validation
> would allow for much more flexibilty than straight masks, as you are
using
> in your library.

You're right, of course. I just thought it would be fun to process the
mask at compile time :) It turns syntax errors in the mask into compile
errors. It also greatly increases your chances for ICE's under VC 6!

>
> Also, I do like your idea of getting rid of static text controls.

Thanks! My motivation for the above example was to show that you can
also get rid of other controls once you incorporate data exchanging into
the gui_manager. The gui_manager<> template is sort of like a rule in
Spirit. It lets you put a big nasty template expression into something
easier to type. In this case you can get/and set employee objects:

   gui_manager<employee> gui = make_gui();

   employee e;

   gui.get(e); //reads from the controls into the employee structure

   gui.set(e); //writes to the controls from the employee structure.

The above snippet was supposed to illustrate that you can get rid of
more complex controls than just a static text control. Here I defined
inline a masked edit, a combo box, and a plain text edit box.

I've got some other functions to implement other GUI idioms, like tying
the enabled status of a group of controls to a check box, an enumeration
to radio buttons, etc... You might notice that there are no Win32
specific objects mentioned above.

My library is not ready for boost, but it is in production. It will be
running the payroll maintenance system for over 800 restaurants soon.
I'd be surprised if there were over a few hundred lines of code (in the
GUI) for a fairly large and complex application.

Brock Peabody
Software Development Manager
NPC International


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