source-code/screens/conversions-screens/kilometres_per_hour_screen.rb
# Draws the kilometres per hour screen on the Shoes app window.
Draws the kilometres per hour screen on the Shoes app window.
Draws the kilometres per hour screen on the Shoes app window .
def kilometres_per_hour_screen
    @heading = 'Kilometres per hour = (velocity × 3600) / 1000'
    background('images/conversions_large.png')
    ScreenHeader.new(self, '/title_screen/conversions_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, 'Velocity')
        flow do
          @velocity = ScreenEditLine.new(self, @@font, @heading)
          @velocity_unit = para(strong(' ms'), strong(sup('-1')))
          @velocity_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.to_kilometres_per_hour(@velocity.text.to_f)
            @kilometres_per_hour = para(@result.to_s)
            @kilometres_per_hour_unit = para(' kmh', sup('-1'))
            @kilometres_per_hour.style(@@screen_result_text_styles)
            @kilometres_per_hour_unit.style(@@screen_result_text_styles)
          end
        end
      end
    end
  end
def kilometres_per_hour_screen @heading = 'Kilometres per hour = (velocity × 3600) / 1000' background ( 'images/conversions_large.png' ) ScreenHeader . new ( self , '/title_screen/conversions_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 , 'Velocity' ) flow do @velocity = ScreenEditLine . new ( self , @@font , @heading ) @velocity_unit = para ( strong ( ' ms' ) , strong ( sup ( '-1' ) ) ) @velocity_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 . to_kilometres_per_hour ( @velocity . text . to_f ) @kilometres_per_hour = para ( @result . to_s ) @kilometres_per_hour_unit = para ( ' kmh' , sup ( '-1' ) ) @kilometres_per_hour . style ( @@screen_result_text_styles ) @kilometres_per_hour_unit . style ( @@screen_result_text_styles ) end end end end end
Draws the kilometres per hour screen on the Shoes app window.
Draws the kilometres per hour screen on the Shoes app window .
# Kilometres per hour screen header # Kilometres per hour screen content # Left margin offset # Content column