Forum: Ruby Ruby to shoes

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
87884b914bb442d23bff13677ca7b63c?d=identicon&s=25 Daniel Meskin (danielm)
on 2016-12-10 00:23
Attachment: ElNm-1.rb (806 Bytes)
Hello! I am having problems with Shoes (shoesrb.com). I wish to create a
frontend for
the program attached. I have included a text version here:
puts "Diary Generator"
puts "Name:"
name = gets.chomp
puts "Yesterday's date:"
n1 = gets.chomp
puts "Today's date:"
n2 = gets.chomp
puts "Tommorow's date:"
n3 = gets.chomp
puts "Yesterday's weather:"
w1 = gets.chomp
puts "Today's weather:"
w2 = gets.chomp
puts "Tommorow's weather:"
w3 = gets.chomp
puts "Today's activity:"
a1 = gets.chomp
puts "Yesterday's activity:"
a2 = gets.chomp
puts "Tommorow's activity:"
a3 = gets.chomp
puts "_______________________________________"
puts "Results"
puts "_______________________________________"
puts "Dear diary"
puts "The date is " + n2 + ". It is " + w2 +  ". I will go to " + a2 +
"."
puts "Yesterday's date was " + n1 + ". It is " + w1 +  ". I will go to "
+ a1 + "."
puts "Tommorow's date is " + n3 + ". It is " + w3 +  ". I will go to " +
a3 + "."
puts name

Thanks for your support, Daniel M
B078cb4f4fb473c7a54d1fc36d10c70e?d=identicon&s=25 Regis d'Aubarede (raubarede)
on 2016-12-12 00:40
here a simple solution, with Ruiby :

===
require 'Ruiby'

Ruiby.app width:300,height:100,title: "Diary " do
  h={
  "Name"             => "",
  "Yesterday's date" => "",
  "Today's date"     => "",
  "Tommorow's date"  => "",
  "Yesterday's weather" => "",
  "Today's weather"     => "",
  "Tommorow's weather"  => "",
  "Today's activity"    =>"",
  "Yesterday's activity"=>"",
  "Tommorow's activity" =>""
  }

  stack do
     properties("Diary Generator",h,:edit=>true) do |h|
       name,n1,n2,n3,w1,w2,w3,a1,a2,a3=h.values
       alert  "The date is#{n2}. It is #{w2}. I will go to #{a1}."
     end
 end
end
===
Ruiby is a dsl, for simple gtk applications.
properties()  is a widget for editing Hash contains.
This topic is locked and can not be replied to.