source-code/screens/forces-screens/force_v1_screen.rb
# Draws the force v1 screen on the Shoes app window.
Draws the force v1 screen on the Shoes app window.
Draws the force v1 screen on the Shoes app window .
def force_v1_screen
    @heading = 'Force = mass x acceleration'
    background('images/forces_large.png')
    ScreenHeader.new(self, '/title_screen/forces_screen', @@font, @heading)
    flow(:height => 640, :width => 1080, :scroll => true) do
      stack(:height => 640, :width => 80) do
      end
      stack(:height => 640, :width => 1000) do
        ScreenLabel.new(self, @@font, @heading, 'Mass')
        flow do
          @mass = ScreenEditLine.new(self, @@font, @heading)
          @mass_unit = para(strong(' kg'))
          @mass_unit.style(@@screen_unit_text_styles)
        end
        ScreenLabel.new(self, @@font, @heading, 'Acceleration')
        flow do
          @acceleration = ScreenEditLine.new(self, @@font, @heading)
          @acceleration_unit = para(strong(' ms'), strong(sup('-2')))
          @acceleration_unit.style(@@screen_unit_text_styles)
        end
        @calculate = button('Calculate')
        @result_display = flow
        @error_display = flow
        @calculate.click do
          @result_display.clear do
            @result = Joules.force_v1(@mass.text.to_f,
                                      @acceleration.text.to_f)
            @force_v1 = para(@result.to_s)
            @force_v1_unit = para(' N')
            @force_v1.style(@@screen_result_text_styles)
            @force_v1_unit.style(@@screen_result_text_styles)
          end
        end
      end
    end
  end
def force_v1_screen @heading = 'Force = mass x acceleration' background ( 'images/forces_large.png' ) ScreenHeader . new ( self , '/title_screen/forces_screen' , @@font , @heading ) flow ( :height => 640 , :width => 1080 , :scroll => true ) do stack ( :height => 640 , :width => 80 ) do end stack ( :height => 640 , :width => 1000 ) do ScreenLabel . new ( self , @@font , @heading , 'Mass' ) flow do @mass = ScreenEditLine . new ( self , @@font , @heading ) @mass_unit = para ( strong ( ' kg' ) ) @mass_unit . style ( @@screen_unit_text_styles ) end ScreenLabel . new ( self , @@font , @heading , 'Acceleration' ) flow do @acceleration = ScreenEditLine . new ( self , @@font , @heading ) @acceleration_unit = para ( strong ( ' ms' ) , strong ( sup ( '-2' ) ) ) @acceleration_unit . style ( @@screen_unit_text_styles ) end @calculate = button ( 'Calculate' ) @result_display = flow @error_display = flow @calculate . click do @result_display . clear do @result = Joules . force_v1 ( @mass . text . to_f , @acceleration . text . to_f ) @force_v1 = para ( @result . to_s ) @force_v1_unit = para ( ' N' ) @force_v1 . style ( @@screen_result_text_styles ) @force_v1_unit . style ( @@screen_result_text_styles ) end end end end end
Draws the force v1 screen on the Shoes app window.
Draws the force v1 screen on the Shoes app window .
# Force v1 screen header # Force v1 screen content # Left margin offset # Content column