Yep. The stack method will return a Shoes::Stack, which has all kinds
of instance methods defined on it. For example:
Shoes.app do
s = stack do
para "This text will disappear."
end
s.remove
end
So you could pass in the current stack object to the ImageHolders, but
stacks aren't usually (yet) used directly like this, so the API for
adjusting them is less documented (as you've discovered), and more
exploratory. I'm sure that this list will benefit greatly from
adventures in Shoes::Object passing, so please pursue it.
— omygawshkenas
On Apr 14, 2008, at 10:50 AM, Dmitrii Dimandt wrote:
Yup, I've sen some of the examples. However, how would I implement a
class that contains a layout itself, so that I could insert it at
any point in another layout?
(I realize I might be missing something ruby-crucial at this point)
For instance, I want to do something like
stack do
ImageHolder "/path/to/image1"
ImageHolder "/path/to/image2"
end
Where ImageHolder is a stack with multiple elements in it. Is there
a way to pass current stack to an element?
On Apr 14, 2008, at 4:05 PM, Jeremy Ashkenas wrote:
Hey Dmitrii —
Shoes.app is friendlier to multiple classes than you might imagine.
You can certainly implement your ImageHolder as a separate class
(defined in the same file, or not) that the Shoes::App tracks and
displays. You can even save and load your ImageHolder instances
from disk, separately from Shoes, using YAML, or PStore or SQLite...
Take a look at some of the more complicated examples on the-
shoebox.org to see how multiple classes are being successfully
used. In many cases, a global reference to the Shoes::App is set,
to make it easier to render graphics from any class.
— omygawshkenas
On Apr 14, 2008, at 7:56 AM, Dmitrii Dimandt wrote:
Hi all!
*two-page-long infatuation with shoes skipped :)*
Long-long ago I made myself an image catalog organizer using
Python and Tkinter.
The central piece of it was an "ImageHolder" component hat
consisted of a stack that contained the image itself, the image's
name in a label, the image's tags in label. Such an imageholder
could be selected/unselected (it wold change border color when
clicked), it had properties that could be manipulated (mostly
related to the contained image - such as rotation, name etc.)
I wonder how all this could be achieved using Shoes, since
everything that happens, happens in the context of the Shoes.app