Thanks for the tip!

On Apr 15, 2008, at 11:54 AM, Yichao Zhang wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Actually, stack is a method of Shoes.app, so you can do

$app.stack {image "/path/1"}

Actually, I tried this:

class View
~  def initialize(shoes)
~    # shoes can be shoes, or a stack, or a flow
~    @shoes = shoes
~  end

~  def rendor_with_shoes
~    paint_some @shoes
~  end
end

$view = View.new
Shoes.app do
~  $view.rendor_with_shoes
end

I couldn't remember clearly, but using local or instance variables was
hard, because the do block was transformed into a class method.

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
|>>
|>>
|>>
|>
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIBG0+55XhWT57AX8RAvaZAJ9JwBwM+E8RRbhf1H4wx+KKBmKjEACgpfuC
KtZOVTapdFAgHj0lkRCXat8=
=CYUb
-----END PGP SIGNATURE-----

Reply via email to