lib/ppcurses/form/form.rb in ppcurses-0.1.0 vs lib/ppcurses/form/form.rb in ppcurses-0.1.1
- old
+ new
@@ -6,10 +6,13 @@
#
# Screen should be of type Curses::Window
#
def initialize
+ super
+ origin = Point.new( 1, 1 )
+ setFrameOrigin(origin)
@elements = []
end
# Formal protocol required
# Adds an element to the form. Elements are rendered in the order they are added.
@@ -27,11 +30,13 @@
@elements.push(element)
if @selected_element.nil?
set_selected_element(@elements[0])
end
-
+
+ @frame.size.height += element.height
+
end
def submitted?
@button_pair.button1.pushed
@@ -59,11 +64,11 @@
end
# TODO -- call display of subview???
def display(screen)
- y = 1
- x = 1
+ y = @frame.origin.y
+ x = @frame.origin.x
for i in 0..@elements.length - 1
element = @elements[i]
screen.setpos(y, x)
element.show(screen)
\ No newline at end of file