source-code/screens/density-screens/density_sub_screen.rb
# Draws the density sub screen on the Shoes app window.
Draws the density sub screen on the Shoes app window.
Draws the density sub screen on the Shoes app window .
def density_sub_screen
    @heading = 'Density = mass / volume'
    background('images/density_large.png')
    ScreenHeader.new(self, '/title_screen/density_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, 'Volume')
        flow do
          @volume = ScreenEditLine.new(self, @@font, @heading)
          @volume_unit = para(strong(' m'), strong(sup('3')))
          @volume_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.density(@mass.text.to_f,
                                     @volume.text.to_f)
            @density = para(@result.to_s)
            @density_unit = para(' kgm', sup('-3'))
            @density.style(@@screen_result_text_styles)
            @density_unit.style(@@screen_result_text_styles)
          end
        end
      end
    end
  end
def density_sub_screen @heading = 'Density = mass / volume' background ( 'images/density_large.png' ) ScreenHeader . new ( self , '/title_screen/density_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 , 'Volume' ) flow do @volume = ScreenEditLine . new ( self , @@font , @heading ) @volume_unit = para ( strong ( ' m' ) , strong ( sup ( '3' ) ) ) @volume_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 . density ( @mass . text . to_f , @volume . text . to_f ) @density = para ( @result . to_s ) @density_unit = para ( ' kgm' , sup ( '-3' ) ) @density . style ( @@screen_result_text_styles ) @density_unit . style ( @@screen_result_text_styles ) end end end end end
Draws the density sub screen on the Shoes app window.
Draws the density sub screen on the Shoes app window .
# Density sub screen header # Density sub screen content # Left margin offset # Content column