Methods
Constants
DEFAULT_FOREGROUND | = | 'black' |
DEFAULT_BACKGROUND | = | 'white' |
DEFAULT_INTERVAL | = | 750 |
Class Public methods
new(parent=nil, keys={})
Link
# File ext/tk/sample/tkballoonhelp.rb, line 46 def initialize(parent=nil, keys={}) @parent = parent || Tk.root @frame = TkToplevel.new(@parent) @frame.withdraw @frame.overrideredirect(true) @frame.transient(TkWinfo.toplevel(@parent)) @epath = @frame.path if keys keys = _symbolkey2str(keys) else keys = {} end @command = keys.delete('command') @interval = keys.delete('interval'){DEFAULT_INTERVAL} _balloon_binding(@interval) # @label = TkLabel.new(@frame, 'background'=>'bisque').pack @label = TkLabel.new(@frame, 'foreground'=>DEFAULT_FOREGROUND, 'background'=>DEFAULT_BACKGROUND).pack @label.configure(_symbolkey2str(keys)) unless keys.empty? @path = @label end
Instance Public methods
command(cmd = Proc.new)
Link
destroy()
Link
epath()
Link
erase()
Link
interval(val)
Link
show()
Link
# File ext/tk/sample/tkballoonhelp.rb, line 91 def show x = TkWinfo.pointerx(@parent) y = TkWinfo.pointery(@parent) @frame.geometry("+#{x+1}+#{y+1}") if @command case @command.arity when 0 @command.call when 2 @command.call(x - TkWinfo.rootx(@parent), y - TkWinfo.rooty(@parent)) when 3 @command.call(x - TkWinfo.rootx(@parent), y - TkWinfo.rooty(@parent), self) else @command.call(x - TkWinfo.rootx(@parent), y - TkWinfo.rooty(@parent), self, @parent) end end @frame.deiconify @frame.raise begin @org_cursor = @parent.cget('cursor') rescue @org_cursor = @parent['cursor'] end begin @parent.configure('cursor', 'crosshair') rescue @parent.cursor('crosshair') end end