Gregory Millam 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 { ... } That seems reasonable, as long as we avoid doing an instance_eval. (see below) > 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"] = ... That is going right over my head at the moment. > You could also have other EzGtk constructs like ... > > main { > title "Hello" > width 20 > height 20 > } > > def width (x) > @currentstackwidget.height = x > end Well, I was thinking of a different method. I made a #setup method (not used in the code I showed) that would yield the widget so that you could make changes to that widget. My basic vision for blocks was: 1. For containers, establish that container as a context 2. For non-containers, associate the block with the "most common" message for that widget Re: 2, Note that it would still be possible to associate other blocks with other messages. ALSO: Note that I never used instance_eval (except in #setup). This is important, because any @var referenced is an @var of App, regardless of block nesting. > 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" { > ... > } For my part, I still like the idea of a "default message" for a given non-container widget. I can be convinced I'm wrong, though. > I'd be interested in giving a hand if you like this idea and want to go with it. Just email me. Cc'ing now. Hal