Currently events such as click and move events are being handled by
Shoes.app or by elements which have been specifically coded to handle
such events (such as link and image).
Since Shoes borrows several ideas from the web, I would really love to
see Shoes adopt event sinking/bubbling model from the web as well.
The only GUI toolkit that adopted this idea is (AFAIR) HTMLayout,
http://www.terrainformatica.com/htmlayout/
The idea behind event sinking/bubbling is described here: http://www.terrainformatica.com/htmlayout/behaviors.whtm
(the section titled "Propagation of Events")
Adopting this technique would allow for an easier creation of complex
behaviors in Shoes.
In recent post I described an image-handling application that I
wanted to write. Pseudo code:
Shoes.app do
flow do
ImagePanel "image1"
ImagePanel "image2"
ImagePanel "image3"
end
end
where each ImagePanel is
stack do
subtitle "image name"
image "image"
para "tag1", "tag2", "tag3" #and so on
end
Now, if a user single-clicks the ImagePanel, it should become
"selected", i.e. change it's border color and possibly background-
color. This can be done by capturing the click event in the sinking
phase and by stopping it's propagation in the ImagePanel stack
If a user double-clicks the image, an "open file" dialog should pop
up, allowing the user to select a different image and the ImagePanel
should become "selected". This can be done by capturing the event in
the image and by allowing it to "bubble up" to the stack
Is this idea even worth considering? :)