lib/ppcurses/form/form.rb in ppcurses-0.1.1 vs lib/ppcurses/form/form.rb in ppcurses-0.1.2
- old
+ new
@@ -24,11 +24,11 @@
# - def set_curs_pos(screen)
# - def key_down(key)
# - def selected=
#
def add (element)
- PPCurses.implements_protocol( element, %w(show height set_curs_pos key_down selected=))
+ PPCurses.implements_protocol( element, %w(show height set_curs_pos key_down selected= clear))
@elements.push(element)
if @selected_element.nil?
set_selected_element(@elements[0])
end
@@ -76,9 +76,16 @@
y += element.height
end
@selected_element.set_curs_pos(screen) unless @selected_element.nil?
+ end
+
+ # clears or resets all values of elements in the form
+ def clear
+ for i in 0..@elements.length - 1
+ @elements[i].clear
+ end
end
# --------------------------------------------------------------------------------
protected
\ No newline at end of file