source-code/screens/pressure-screens/hydrostatic_pressure_screen.rb
# Draws the hydrostatic pressure screen on the Shoes app window.
Draws the hydrostatic pressure screen on the Shoes app window.
Draws the hydrostatic pressure screen on the Shoes app window .
def hydrostatic_pressure_screen
    @heading = 'Hydrostatic pressure = density x acceleration of free fall x height'
    background('images/pressure_large.png')
    ScreenHeader.new(self, '/title_screen/pressure_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, 'Density')
        flow do
          @density = ScreenEditLine.new(self, @@font, @heading)
          @density_unit = para(strong(' kgm'), strong(sup('-3')))
          @density_unit.style(@@screen_unit_text_styles)
        end
        ScreenLabel.new(self, @@font, @heading, 'Height')
        flow do
          @height = ScreenEditLine.new(self, @@font, @heading)
          @height_unit = para(strong(' m'))
          @height_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.hydrostatic_pressure(@density.text.to_f,
                                                  @height.text.to_f)
            @hydrostatic_pressure = para(@result.to_s)
            @hydrostatic_pressure_unit = para(' Pa')
            @hydrostatic_pressure.style(@@screen_result_text_styles)
            @hydrostatic_pressure_unit.style(@@screen_result_text_styles)
          end
        end
      end
    end
  end
def hydrostatic_pressure_screen @heading = 'Hydrostatic pressure = density x acceleration of free fall x height' background ( 'images/pressure_large.png' ) ScreenHeader . new ( self , '/title_screen/pressure_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 , 'Density' ) flow do @density = ScreenEditLine . new ( self , @@font , @heading ) @density_unit = para ( strong ( ' kgm' ) , strong ( sup ( '-3' ) ) ) @density_unit . style ( @@screen_unit_text_styles ) end ScreenLabel . new ( self , @@font , @heading , 'Height' ) flow do @height = ScreenEditLine . new ( self , @@font , @heading ) @height_unit = para ( strong ( ' m' ) ) @height_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 . hydrostatic_pressure ( @density . text . to_f , @height . text . to_f ) @hydrostatic_pressure = para ( @result . to_s ) @hydrostatic_pressure_unit = para ( ' Pa' ) @hydrostatic_pressure . style ( @@screen_result_text_styles ) @hydrostatic_pressure_unit . style ( @@screen_result_text_styles ) end end end end end
Draws the hydrostatic pressure screen on the Shoes app window.
Draws the hydrostatic pressure screen on the Shoes app window .
# Hydrostatic pressure screen header # Hydrostatic pressure screen content # Left margin offset # Content column