Yeah, Shoes Has Just a Few Simple Controls
Hello, let’s do more Shoes.
Oh and fellows: Shoes isn’t an acronym. It’s just a name. And the name is Shoes. Its pronounced just like normal shoes. Except it’s spelled Shoes. It’s not spelled in any other way. If you are Charles Dickens, you have permission to call it Shuse. But UNLESS YOU ARE CHARLES DICKENS, I beg you. Shoes. Trust me, I know what I’m doing this time!
Here’s today’s example:
name, phone, address = nil
Shoes.app do
background "rgb(240, 245, 220)"
stack do
stack :margin => 10 do
text "Name"
name = list_box :items => ["Philarp Tremaine", "Dirk Hockeybranch"]
end
stack :margin => 10 do
text "Address"
address = edit_line
end
stack :margin => 10 do
text "Phone"
phone = edit_line
end
stack :margin => 10 do
button "Save" do
Shoes.p [name.text, address.text, phone.text]
end
end
end
end
So I guess this one’s a bit boring. But the idea is to build something like an HTML form in Shoes. And here we have pairs of title text and control divided into their own little stacks. I use a stack so everything will pile up vertically.
The list_box
is akin to a select box. The edit_line
is the single-line text input. And, well, button
. The two other Shoes controls are presently edit_box
and progress
, though they aren’t fully finished yet.
Last thing: Shoes.p
. This is just like Kernel.p
, except that it prints to the proper debug output. On Linux and OSX, this is STDOUT. On Windows, it’s DebugView. Not sure if this will stick around.
Update: Okay, Shoes r60 builds are out.
Now begin the comments …
Mark Murphy
Based on this and some of the other examples, it feels like stacks are vertical layouts of elements. The StacksAndFlows page on the wiki, though, says it is a “horizontal stack of elements”. Is that a typo? If not, what am I missing?
_why
Yes, you’re absolutely right. A typo.
cdcarter
Are there plans for HTML tables, or any sort of table display actually?
_why
Sorry, no, the HTML support is limited and will probably go away eventually.
But you can do tables with stacks and flows. So, I’d say: write a
table
method that generates the stacks to do it.evan
This is totally not the place to say! But I just had to. Are you aware of Helium? (Balloon theme returns, Haskell.)
brad
How about Markaby style css? The code is already quite Markabyish so it would fit nicely.
Phrogz
background ‘rgb(240, 245, 220)’
Oh come now, who let the quotes in? I don’t get along well with them, not after the Great Apostrophe Incident of ’98.
Couldn’t
rgb
be a method that returns a simple hex string or fancy-ass UberColor instance?cdcarter
_why:
I tried writing a table method and ended up having all the text elements floating on top of each other. Two questions:
* Is there a way to introspect the current window size?
* Can I give a stack or flow a border?
Comments are closed for this entry.