Class: Tk::RbWidget::Editable_Listbox

Inherits:
TkListbox
  • Object
show all
Defined in:
sample/editable_listbox.rb,
sample/editable_listbox.rb

Constant Summary collapse

BindTag =

TkBindTag.new_by_name(self.to_s.gsub(/::/, '#'))

Instance Method Summary collapse

Instance Method Details

#configure(*args) ⇒ Object




48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'sample/editable_listbox.rb', line 48

def configure(*args)
  ret = super

  case cget(:state)
  when 'normal'
    # do nothing
  when 'disabled'
    _ebox_erase
  else # unknown
    # do nothing

  end

  ret
end

#create_self(keys) ⇒ Object



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'sample/editable_listbox.rb', line 115

def create_self(keys)
  super(keys)

  unless self.listvariable
    self.listvariable = TkVariable.new(self.get(0, :end))
  end

  @ebox = TkEntry.new(self){
    @pos = nil
    def self.pos; @pos; end
    def self.pos=(idx); @pos = idx; end
  }

  _setup_ebox_bindings
  _setup_listbox_bindings
end

#yview(*args) ⇒ Object



106
107
108
109
110
111
112
113
# File 'sample/editable_listbox.rb', line 106

def yview(*args)
  if !@ebox.pos || bbox(@ebox.pos).empty?
    @ebox.place_forget
  else
    _ebox_move(@ebox.pos)
  end
  super
end