'
' Demo shamelessly ripped from the NCURSES PROGRAMMING HOWTO:
'   http://tldp.org/HOWTO/NCURSES-Programming-HOWTO
'
' Ported to BaCon in June 2010 - PvE (GPLv3)
'
'------------------------------------------------------------------

INCLUDE "curses.bac"
INCLUDE "panel.bac"

DECLARE my_wins[3]
DECLARE my_panels[3]

DECLARE lines, cols, y, x, i TYPE int

lines = 10
cols = 40
y = 2
x = 4

initscr()
cbreak()
noecho()

' Create windows for the panels
my_wins[0] = newwin(lines, cols, y, x)
my_wins[1] = newwin(lines, cols, y + 1, x + 5)
my_wins[2] = newwin(lines, cols, y + 2, x + 10)

' Create borders around the windows so that you can see the effect of panels
FOR i = 0 TO 2
    box(my_wins[i], 0, 0)
NEXT

' Attach a panel to each window - Order is bottom up
my_panels[0] = new_panel(my_wins[0])
my_panels[1] = new_panel(my_wins[1])
my_panels[2] = new_panel(my_wins[2])

' Update the stacking order. 2nd panel will be on top
update_panels()

' Show it on the screen
doupdate()

getch()
endwin()