Received: Thu, 8 Apr 2004 03:13:24 +0900
And lo, Hal wrote:
Correct assessment. But there are times when you’d want to capture
references to the widgets.
That’s the reason I yielded with the widget itself. The code I wrote is just a hack, and would probably be better like this
def vbox
myvbox = VBox.new
… (same)
myvbox /* return the widget */
end
That way, one could even make something that does:
@myvbox = vbox { … }
It would also be nicer to have a class-independent method for this, so you could:
myvbox = EzGtk.vbox { … }
So it wouldn’t use class variables. Perhaps a thread-global variable?
Thread.current[“storefunc”] = …
There are a large number of cleaner ways to rewrite the code I gave above.
You could also have other EzGtk constructs like …
main {
title “Hello”
width 20
height 20
}
def width (x)
@currentstackwidget.height = x
end
Other simple things like that.
That button () construct doesn’t quite strike me as correct - and could probably be done better
button “buttonname” {
on_click { … }
}
Make it more generic across container-type objects. OTOH, Buttons are rarely used as such a container. ponder ponder ponder …
Maybe
button_onclick “buttonname” {
…
}
I’d be interested in giving a hand if you like this idea and want to go with it. Just email me.
- Greg Millam