What am I doing wrong with my Shoes program?

Posted by dmonroe4919 on Stack Overflow See other posts from Stack Overflow or by dmonroe4919
Published on 2010-03-21T14:12:33Z Indexed on 2010/03/21 14:21 UTC
Read the original article Hit count: 338

Filed under:
#Shoes.app(:title => "Collinear Points", :width => 450, :height 

=> 350) do    

   def calculate
      math.sqrt(((@[email protected]_f)**2)+((@[email protected]_f)**2)+((@[email protected]_f)**2))
   end

   def compute
      math.sqrt(((@[email protected]_f)**2)+((@[email protected]_f)**2)+((@[email protected]_f)**2))
   end


   def capture
      math.sqrt(((@[email protected]_f)**2)+((@[email protected]_f)**2)+((@[email protected]_f)**2))
   end

      stack(:width => '100%', :margin => 20) do
         para('Calculate Collinear Points') 
         para('                           x                       y                 z')          
      end

      flow(:width => '100%' ) do
         para('Point A: ')
      @alphax = edit_line(:width => 100, height => 35) {@collinear.text = calculate}
      @alphay = edit_line(:width => 100, height => 35) {@collinear.text = calculate}
      @alphaz = edit_line(:width => 100, height => 35) {@collinear.text = calculate}
      end
      flow(:width => '100%' ) do
         para('Point B: ')
      @betax = edit_line(:width => 100, height => 35) {@collinear.text = compute}
      @betay = edit_line(:width => 100, height => 35) {@collinear.text = compute}
      @betaz = edit_line(:width => 100, height => 35) {@collinear.text = compute}
      end
      flow(:width => '100%' ) do
         para('Point C: ')
      @gammax = edit_line(:width => 100, height => 35) {@collinear.text = capture}
      @gammay = edit_line(:width => 100, height => 35) {@collinear.text = capture}
      @gammaz = edit_line(:width => 100, height => 35) {@collinear.text = capture}
      end

      button("Configure")

      @button.click do
         c = calculate+compute=capture
         case c
            when c=true
            alert("Points are collinear, equation is ")
            when c=false
            alert("Points are non-collinear")

   end
end

© Stack Overflow or respective owner

Related posts about ruby