Boost logo

Boost :

From: Steven Watanabe (steven_at_[hidden])
Date: 2007-03-28 12:40:05


AMDG

Michael Fawcett <michael.fawcett <at> gmail.com> writes:

>
> On 3/28/07, Steven Watanabe <steven <at> providere-consulting.com> wrote:
> >
> > Here is how I would do it:
> >
> > quantity<SI::length> on_dialog_ok()
> > {
> > double conversion = combo.selected_item().data();
> > double value = entry.value().as_double();
> > return quantity<SI::length>::from_value(conversion * value);
> > }
>
> There may be some confusion (again) on my part as to what
> combo.selected_item.data() is returning, and how it's useful to the
> quantity directly. I was assuming from Noah's post that it was either
> the integer of the currently selected item in the combo box, or the
> string of the currently selected item in the combo box. I can see how
> both of those could be immediately useful to the run-time quantity.
> It would either know that the number, say 5, mapped to feet, or it
> would be passed "feet".
>
> What does your version do exactly? What is
> combo.selected_item().data() returning, why is it a double, and how
> does from_value use it?
>
> --Michael Fawcett

The confusion could be on my part. I was thinking
that the combo box would allow arbitrary data to
be associated with the each item. If this is not
the case then you need either a map or a switch
statement regardless of whether the units are compile
time or runtime.

In Christ,
Steven Watanabe


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