I recently started playing with Shoes to learn it during my Ruby
It appears to be easy, although the current doc is not what a beginner
like I would prefer.
googling around I found a nice website,
http://shoes-tutorial-note.heroku.com/, which has some nice simple
samples programs, just what beginners, like I, need.
On my learning, I heavely borrowed from a program, simple-calc.rb,
listed on the tutorial mentioned above. I hope the developer of this
pgm does not get upset.
I have some questions which I would like help with.
1 - When placing a number of buttons, such as the ones found in a
calculator, how can I tell Shoes to place them on the center of the
pane, without having to specify margin?
flow :width => "100%", :margin => 58 do %w(7 8 9 + sin 4 5 6 - cos 1 2 3 * sinh tan cot 0 ln /
cosh Exp log
tanh = Mod n! sqrt x2 xy % e Pi Clr Ce).each do |btn|
button btn, :width => 46, :height => 46 do
method = case btn
when /[0-9]/; ‘press_’+btn
when ‘+’; ‘press_add’
when ‘-’; ‘press_sub’
when ‘*’; ‘press_times’
when ‘/’; ‘press_div’
when ‘=’; ‘press_equals’
ect, etc, etc end # case end # button do end # each do end # flow
2 - I am using a stack do with nothing inside (between the do and the
end) to keep items within a flow one on top of the other, is there a
different way to do this?
flow :margin => 6 do
radio; para strong(“512b BK”)
radio; para strong(“1K BK”)
radio; para strong(“MB”)
radio; para strong(“GB”)
radio; para strong(“TB”)
stack do # I am using this as a way to stack up groups. # There might be a much better way! end radio; para strong("Deg") radio; para strong("Rad") radio; para strong("Grad") radio; para strong("DEC") radio; para strong("HEX") radio; para strong("BIN") end # flow
3 - I tried to use the Pi symbol and the square root (âˆš) symbol and
other symbols as caption/lable for the corresponding buttons, but I
got an errors or the wrong thing displayed. Is there a way to
4 - It looks like I can achieve the same function with para and
caption. What is the difference between the two?
5 - How can I reduce the space between flows?
Thank you for your help!