source-code/screens/geometry-screens/circumference_screen.rb
# Draws the circumference screen on the Shoes app window.
Draws the circumference screen on the Shoes app window.
Draws the circumference screen on the Shoes app window .
def circumference_screen
    @heading = 'Circumference = 2π × radius'
    background('images/geometry_large.png')
    ScreenHeader.new(self, '/title_screen/geometry_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, 'Radius')
        flow do
          @radius = ScreenEditLine.new(self, @@font, @heading)
          @radius_units = ['cm', 'm', 'km', 'in', 'ft', 'yd', 'mi']
          @radius_unit = list_box(:width => 100,
                                  :font => @@font,
                                  :items => @radius_units)
        end
        @calculate = button('Calculate')
        @result_display = flow
        @error_display = flow
        @calculate.click do
          @result_display.clear do
            @result = Joules.circumference(@radius.text.to_f)
            @circumference = para(@result.to_s)
            @circumference_unit = para(" #{@radius_unit.text}")
            @circumference.style(@@screen_result_text_styles)
            @circumference_unit.style(@@screen_result_text_styles)
          end
        end
      end
    end
  end
def circumference_screen @heading = 'Circumference = 2π × radius' background ( 'images/geometry_large.png' ) ScreenHeader . new ( self , '/title_screen/geometry_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 , 'Radius' ) flow do @radius = ScreenEditLine . new ( self , @@font , @heading ) @radius_units = [ 'cm' , 'm' , 'km' , 'in' , 'ft' , 'yd' , 'mi' ] @radius_unit = list_box ( :width => 100 , :font => @@font , :items => @radius_units ) end @calculate = button ( 'Calculate' ) @result_display = flow @error_display = flow @calculate . click do @result_display . clear do @result = Joules . circumference ( @radius . text . to_f ) @circumference = para ( @result . to_s ) @circumference_unit = para ( " #{@radius_unit.text}" ) @circumference . style ( @@screen_result_text_styles ) @circumference_unit . style ( @@screen_result_text_styles ) end end end end end
Draws the circumference screen on the Shoes app window.
Draws the circumference screen on the Shoes app window .
# Circumference screen header # Circumference screen content # Left margin offset # Content column