Module: Fzeet::ComboBoxMethods

Includes:
ListBoxMethods
Included in:
ComboBox, ComboBoxExMethods
Defined in:
lib/fzeet/Control/ComboBox.rb

Instance Method Summary collapse

Methods included from ListBoxMethods

#append, #clear, #each, #length, #selected=

Instance Method Details

#[](i) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fzeet/Control/ComboBox.rb', line 9

def [](i)
	i = sendmsg(:getcursel) if i == :selected

	return '' if i == -1 || (len = textlen(i) + 1) == 1

	''.tap { |item|
		FFI::MemoryPointer.new(:char, len) { |buf|
			raise "GETLBTEXT failed." if sendmsg(:getlbtext, i, buf) == -1

			item << buf.read_string
		}
	}
end

#textlen(i) ⇒ Object



7
# File 'lib/fzeet/Control/ComboBox.rb', line 7

def textlen(i) raise "GETLBTEXTLEN failed." if (len = sendmsg(:getlbtextlen, i)) == -1; len end