source-code/screens/oscillations-screens/time_period_v3_screen.rb
def time_period_v3_screen
    background('images/oscillations_large.png')

    # Time period v3 screen header
    flow(:height => 80, :width => 1080, :scroll => false) do
      @back_button = image('images/back_icon_white.png',
                           :click => '/title_screen/oscillations_screen')
      @heading = title('Time period = 2π x (pendulum length / acceleration of free fall)',
                       sup('0.5'))
      @back_button.style(@@screen_header_image_styles)
      @heading.style(@@screen_header_text_styles)
    end

    # Time period v3 screen content
    flow(:height => 640, :width => 1080, :scroll => true) do
      # Left margin offset
      stack(:height => 640, :width => 80) do
      end
      # Content column
      stack(:height => 640, :width => 1000) do
        @heading_edited = @heading.text
        ScreenLabel.new(self, @@font, @heading_edited, 'Pendulum length')
        flow do
          @pendulum_length = ScreenEditLine.new(self, @@font, @heading_edited)
          @pendulum_length_unit = para(strong(' m'))
          @pendulum_length_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.time_period_v3(@pendulum_length.text.to_f)
            @time_period_v3 = para(@result.to_s)
            @time_period_v3_unit = para(' s')
            @time_period_v3.style(@@screen_result_text_styles)
            @time_period_v3_unit.style(@@screen_result_text_styles)
          end
        end
      end
    end
  end
# Draws the time period v3 screen on the Shoes app window.
Draws the time period v3 screen on the Shoes app window.
Draws the time period v3 screen on the Shoes app window .
def time_period_v3_screen
    background('images/oscillations_large.png')
    flow(:height => 80, :width => 1080, :scroll => false) do
      @back_button = image('images/back_icon_white.png',
                           :click => '/title_screen/oscillations_screen')
      @heading = title('Time period = 2π x (pendulum length / acceleration of free fall)',
                       sup('0.5'))
      @back_button.style(@@screen_header_image_styles)
      @heading.style(@@screen_header_text_styles)
    end
    flow(:height => 640, :width => 1080, :scroll => true) do
      stack(:height => 640, :width => 80) do
      end
      stack(:height => 640, :width => 1000) do
        @heading_edited = @heading.text
        ScreenLabel.new(self, @@font, @heading_edited, 'Pendulum length')
        flow do
          @pendulum_length = ScreenEditLine.new(self, @@font, @heading_edited)
          @pendulum_length_unit = para(strong(' m'))
          @pendulum_length_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.time_period_v3(@pendulum_length.text.to_f)
            @time_period_v3 = para(@result.to_s)
            @time_period_v3_unit = para(' s')
            @time_period_v3.style(@@screen_result_text_styles)
            @time_period_v3_unit.style(@@screen_result_text_styles)
          end
        end
      end
    end
  end
def time_period_v3_screen background ( 'images/oscillations_large.png' ) flow ( :height => 80 , :width => 1080 , :scroll => false ) do @back_button = image ( 'images/back_icon_white.png' , :click => '/title_screen/oscillations_screen' ) @heading = title ( 'Time period = 2π x (pendulum length / acceleration of free fall)', sup ( '0.5' ) ) @back_button . style ( @@screen_header_image_styles ) @heading . style ( @@screen_header_text_styles ) end flow ( :height => 640 , :width => 1080 , :scroll => true ) do stack ( :height => 640 , :width => 80 ) do end stack ( :height => 640 , :width => 1000 ) do @heading_edited = @heading . text ScreenLabel . new ( self , @@font , @heading_edited , 'Pendulum length' ) flow do @pendulum_length = ScreenEditLine . new ( self , @@font , @heading_edited ) @pendulum_length_unit = para ( strong ( ' m' ) ) @pendulum_length_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 . time_period_v3 ( @pendulum_length . text . to_f ) @time_period_v3 = para ( @result . to_s ) @time_period_v3_unit = para ( ' s' ) @time_period_v3 . style ( @@screen_result_text_styles ) @time_period_v3_unit . style ( @@screen_result_text_styles ) end end end end end
Draws the time period v3 screen on the Shoes app window.
Draws the time period v3 screen on the Shoes app window .
# Time period v3 screen header # Time period v3 screen content # Left margin offset # Content column