Class: TkProgressframe
- Inherits:
-
TkFloatTitledFrame
- Object
- TkFrame
- TkBaseTitledFrame
- TkFloatTitledFrame
- TkProgressframe
- Defined in:
- lib/a-tkcommons.rb
Constant Summary
Constants included from TkResizable
TkResizable::MIN_HEIGHT, TkResizable::MIN_WIDTH
Instance Attribute Summary collapse
-
#max ⇒ Object
Returns the value of attribute max.
Attributes inherited from TkBaseTitledFrame
Instance Method Summary collapse
-
#initialize(parent = nil, _max = 100, *args) ⇒ TkProgressframe
constructor
A new instance of TkProgressframe.
- #on_cancel=(_proc) ⇒ Object
- #progress(_incr = 1) ⇒ Object
- #quit ⇒ Object
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.
1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 |
# File 'lib/a-tkcommons.rb', line 1144 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).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
#max ⇒ Object
Returns the value of attribute max.
1143 1144 1145 |
# File 'lib/a-tkcommons.rb', line 1143 def max @max end |
Instance Method Details
#on_cancel=(_proc) ⇒ Object
1179 1180 1181 |
# File 'lib/a-tkcommons.rb', line 1179 def on_cancel=(_proc) @b_cancel.bind_append('1', _proc) end |
#progress(_incr = 1) ⇒ Object
1175 1176 1177 |
# File 'lib/a-tkcommons.rb', line 1175 def progress(_incr=1) @progress.numeric += _incr end |
#quit ⇒ Object
1171 1172 1173 |
# File 'lib/a-tkcommons.rb', line 1171 def quit #self.destroy end |