|
Boost : |
From: Hajo Kirchhoff (mailinglists_at_[hidden])
Date: 2004-11-17 12:13:07
John Torjo wrote:
>Hajo Kirchhoff wrote:
>> I've written a new article explaining the interface. A behind the scenes look will follow shortly:
>>
>> http://www.litwindow.com/Library/Articles/rapidui_article_3.htm
> This sounds very nice in theory...
This is not a theory. Download the project, build it and try it yourself.
>
> ... But, please implement this:
> A dialog with
> - two edit boxes (width and height)
> - a check box (maintain_ratio)
>
> If maintain_ratio is checked, whatever is typed on width is synchronized
> with height, and vice versa (they preserve the original ratio).
>
> If maintain_ration is not checked, witdh and height can be modified
> independent of each-other.
This exists today in version 0.3.1:
// please unwrap these lines
BEGIN_RULES(dialog)
RULE("eb_height.value",
if_else(make_expr<bool>("cb_maintain_ratio.value"),
make_expr<wxString>("eb_width.value"),
make_expr<wxString>("eb_height.value"))
RULE("eb_width.value",
if_else(make_expr<bool>("cb_maintain_ratio.value"),
make_expr<wxString>("eb_height.value"),
make_expr<wxString>("eb_width.value"))
END_RULES()
It looks complicated because I am using C++ templates to specify rules
that are lazily linked and evaluated only when a widget or data element
changes its value.
As the parser and named rules will be implemented next, the following
will work next year...
rule_editboxes {
eb_height.value <=> eb_width.value // two way rule
}
rule_editboxes.enabled = cb_maintain_ratio.value
The first rule links the edit boxes. The second rule enables the first
rule when the checkbox is checked and disables when it is not checked.
I don't have the time to write the example you suggest now, although it
is a nice example. But perhaps the other two samples I've written
already will suffice. Contained in the project
(http://www.litwindow.com/library) you will find...
The generic sample has a radiobox and an editcontrol. Whenever you
change the radiobox, the value in the editcontrol gets updated and vice
versa.
The RssReader sample links a couple of listboxes and an html window
together. When the user changes the selection of the rss channels list
box, the headlines list box is updated automatically. When the user
selects a different headline, the news item html window is updated
automatically. Rules are
headlines_listbox.items = channels_listbox.current.m_headlines
newsitem_htmlwin.page = headlines_listbox.current.m_page
Regards and thanks for sharing your thoughts.
Hajo Kirchhoff
http://www.litwindow.com/library
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk