[fxruby-users] fxruby and framecontrole

Lyle Johnson lyle at lylejohnson.name
Wed Dec 12 18:21:33 EST 2007


On 12/12/07, Ernst J. Tanaka <ernst at tanakasite.com> wrote:

> My question is how do I reset righttopframe and rightbottomframe after
> handling treeitem(1) and before click on the next item.

I think the important question is what you mean by "reset". Acually, a
question very similar to yours came up the other day on the mailing
list; here's a link to the first post in that thread:

    http://rubyforge.org/pipermail/fxruby-users/2007-December/001371.html

My advice in that thread was to just update the values associated with
the widgets (if possible) instead of removing and re-creating them.
For example, suppose the top-right frame contains three widgets. You
can update their values by simply setting new values for their text,
e.g.

    on click treeItem
        button.text = "New button text"
        label.text = "New label text"
        textfield.text = "New text field text"
    end

You can do something similar to update the contents of the
bottom-right frame at the appropriate time.

If, however, you really do need to get rid of the widgets in the
top-right frame, use removeChildren() and not destroy(), e.g.

    parent = righttopframe.parent
    parent.removeChild(righttopframe)

Note that this won't set righttopframe to nil, so you need to be
careful not to use that value anymore until you assign some new value
to it.

Hope this helps,

Lyle


More information about the fxruby-users mailing list