Class: TkProgressframe

Inherits:
TkFloatTitledFrame show all
Defined in:
lib/a-tkcommons.rb

Constant Summary

Constants included from TkResizable

TkResizable::MIN_HEIGHT, TkResizable::MIN_WIDTH

Instance Attribute Summary collapse

Attributes inherited from TkBaseTitledFrame

#frame, #top

Instance Method Summary collapse

Methods inherited from TkFloatTitledFrame

#head_buttons, #hide, #hide_if_visible, #on_arcadia, #on_close=, #show, #show_grabbed, #title

Methods included from TkResizable

#resizing_do_move_obj, #resizing_do_press, #start_resizing, #stop_resizing

Methods included from TkMovable

#moving_do_move_obj, #moving_do_press, #start_moving, #stop_moving

Methods inherited from TkBaseTitledFrame

#add_fixed_button, #add_fixed_menu_button, #add_fixed_panel, #add_fixed_progress, #add_fixed_sep, #create_frame, #head_buttons, #menu_button, #visible?

Constructor Details

#initialize(parent = nil, _max = 100, *args) ⇒ TkProgressframe

Returns a new instance of TkProgressframe.



2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
# File 'lib/a-tkcommons.rb', line 2045

def initialize(parent=nil, _max=100, *args)
  super(parent)
  _max=1 if _max<=0
  @max = _max
  @progress = TkVariable.new
  @progress.value = -1
  Tk::BWidget::ProgressBar.new(self, :width=>150, :height=>10,
  :background=>'red',
  :foreground=>'blue',
  :variable=>@progress,
  :borderwidth=>0,
  :relief=>'flat',
  :maximum=>_max).place('width' => '150','x' => 25,'y' => 30,'height' => 15)

  @buttons_frame = TkFrame.new(self, Arcadia.style('panel')).pack('fill'=>'x', 'side'=>'bottom')

  #@b_cancel = TkButton.new(@buttons_frame, Arcadia.style('button')){|_b_go|
  @b_cancel = Arcadia.wf.titletoolbutton(@buttons_frame){|_b_go|
    default  'disabled'
    text  'Cancel'
    overrelief  'raised'
    justify  'center'
    pack('side'=>'top','ipadx'=>5, 'padx'=>5)
  }

  place('x'=>100,'y'=>100,'height'=> 120,'width'=> 200)
end

Instance Attribute Details

#maxObject

Returns the value of attribute max.



2044
2045
2046
# File 'lib/a-tkcommons.rb', line 2044

def max
  @max
end

Instance Method Details

#on_cancel=(_proc) ⇒ Object



2081
2082
2083
# File 'lib/a-tkcommons.rb', line 2081

def on_cancel=(_proc)
  @b_cancel.bind_append('1', _proc)
end

#progress(_incr = 1) ⇒ Object



2077
2078
2079
# File 'lib/a-tkcommons.rb', line 2077

def progress(_incr=1)
  @progress.numeric += _incr
end

#quitObject



2073
2074
2075
# File 'lib/a-tkcommons.rb', line 2073

def quit
  #self.destroy
end