8.3.09

Ten Steps in Shoes: step 3, Buttons

An image says more than a thousand words. Trying trying to find the right image to convey the words takes a thousand clicks. While Google takes the lead in many different technologies nowadays, they have not yet found a smart way to index pictures. Usually, finding the right picture for a new blogpost takes ages.

Good news though, a while back I bought my first DSRL camera and am fully experimenting with it at the moment. So, in the future I can just make my pics in stead of searching the internets.

But, while an image can say more than a thousand words, does it speak the same language as the observer? Well, like many things it's all a matter of perspective.
The above image can be viewed from a few perspectives providing an impression of the situation of my blog. One one hand we see Shoes taking steps. Like the series I was supposed to blog. On the other hand we see a person standing still. That's me standing still, being preoccupied with stuff, not blogging or doing much else. He's stepped upon by a giant. That giant might well represent Google crushing me with too much information in one step, deleting my
draft-blogposts with the other. Taking another point of view it could be me taking steps again. Maybe it was me taking steps on myself...

...right, anyway, it's time to check out the Shoes button!

Here's how you add a button to a Shoes app:

Shoes.app do
b = button("button")
end

Now we want the button to do something. You can pass a block to a button like so:
Shoes.app do
b = button("button"){ alert "you pushed the button" }
end

A block is code between { and }, it can be another method, or multiple lines of code, whatever you want. You can read more about blogs at the blogpost on struggling with ruby.

In our block we used an alert, a type of control. Don't worry about those, we will talk more about those in the next step.

So that's it, yeah!

p.s. announcing to do series of blogposts is a really bad idea. Either deal with stuff in one post or don't blog about it. Hard lessons of the blogosphere are learned the hard way!