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, #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_button, #add_menu_button, #create_frame, #head_buttons, #menu_button

Constructor Details

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

Returns a new instance of TkProgressframe.



1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
# File 'lib/a-tkcommons.rb', line 1101

def initialize(parent=nil, _max=100, *args)
  super(parent)
  @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).pack('fill'=>'x', 'side'=>'bottom')	

  @b_cancel = TkButton.new(@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.



1100
1101
1102
# File 'lib/a-tkcommons.rb', line 1100

def max
  @max
end

Instance Method Details

#on_cancel=(_proc) ⇒ Object



1135
1136
1137
# File 'lib/a-tkcommons.rb', line 1135

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

#progress(_incr = 1) ⇒ Object



1131
1132
1133
# File 'lib/a-tkcommons.rb', line 1131

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

#quitObject



1127
1128
1129
# File 'lib/a-tkcommons.rb', line 1127

def quit
  #self.destroy
end