module TkResizable
Constants
- MIN_HEIGHT
- MIN_WIDTH
Public Instance Methods
resizing_do_move_obj(_x, _y)
click to toggle source
# File lib/a-tkcommons.rb, line 144 def resizing_do_move_obj(_x, _y) _width0 = TkPlace.info(@moved_obj_r)['width'] _height0 = TkPlace.info(@moved_obj_r)['height'] _width = _width0 + _x - @x0_r _height = _height0 + _y -@y0_r _width = MIN_WIDTH if _width < MIN_WIDTH _height = MIN_HEIGHT if _height < MIN_HEIGHT @moved_obj_r.place('width'=>_width, 'height'=>_height) end
resizing_do_press(_x, _y)
click to toggle source
# File lib/a-tkcommons.rb, line 139 def resizing_do_press(_x, _y) @x0_r = _x @y0_r = _y end
start_resizing(_moving_obj=self, _moved_obj=self)
click to toggle source
# File lib/a-tkcommons.rb, line 125 def start_resizing(_moving_obj=self, _moved_obj=self) @x0_r = 0 @y0_r = 0 @moving_obj_r = _moving_obj @moved_obj_r = _moved_obj @moving_obj_r.bind_append("B1-Motion", proc{|x, y| resizing_do_move_obj(x,y)},"%x %y") @moving_obj_r.bind_append("ButtonPress-1", proc{|x, y| resizing_do_press(x, y)},"%x %y") end
stop_resizing()
click to toggle source
# File lib/a-tkcommons.rb, line 134 def stop_resizing @moving_obj_r.bind_remove("B1-Motion") @moving_obj_r.bind_remove("ButtonPress-1") end