punkie -

You need to make this change in the drawscreen subroutine:

Box ($y,$x,$y + $height,$x + $width,"SINGLE")

I think there is going to be problems with the parameters for $_maxrows and $height. Here is my proposed code modifications. Please note that the parameter order has changed.

code:
  
; KixMenu.kix
; version 1.0 for Kix2001
; written by Dean E. Behrman
; created 06.25.2002

; modified by punkie june 28, 2002

; modified 06.28.2002 by Dean E. Behrman

function kixmenu ($_array,optional $_title,$x,$y,$colw,$width,$height)
; $_array: Items to display in tabular format
; $_title: Optional title for the window
; $x,$y: Menu position.
; $colw: Width between colums.
; $width: Menu width.
; $height: Menu height.

cls

dim $_width,$_acount,$_cols,$_rows,$_currow,$_curcol,$_curitem,$_colitems[1],$_rowitems[1],$_x,$_key
$_rc = setoption("HideCursor","ON")
$_width = $colw $_currow = 0 $_curcol = 0 $_curitem = 0
if $height <= 0
$height = 24
endif

$_acount = ubound($_array)
for $_x = 0 to $_acount
$_item = $_array[$_x]
if len($_item) > $_width
$_width = len($_item)
endif
next

$_maxcols = 78 / ($_width + 1)
if $_maxcols < 1 or $_acount > ($_maxcols * $height)
$kixmenu = -1
goto end
endif
if $_acount / $_cols > $height
$kixmenu = -1
goto end
endif
$_cols = ($_acount / $height) + 1
$_rows = $height ; ($_acount + 1) / $_cols
gosub drawscreen
gosub buildmenu
gosub pickitem
:end
$rc = setoption("HideCursor","OFF")
cls
return

:drawscreen
Color w+/b
Box ($y,$x,$y + $height + 1,$x + $width,"SINGLE")
if $_title <> "" and $_title <> 0
at ($y,$x+1) $_title
endif
return

:buildmenu
$_curitem = 0
redim $_colitems[$_cols], $_rowitems[$_rows]
for $_curcol = 0 to $_cols
for $_currow = 0 to $_rows - 1
if $_curitem <= $_acount
at ($_currow + $y+1,$_curcol * ($_width + 1) + $x+1) $_array[$_curitem]
$_colitems[$_curcol] = $_currow
$_rowitems[$_currow] = $_curcol
endif
$_curitem = $_curitem + 1
next
next
return

:pickitem
$_currow = 0 $_curcol = 0 $_curitem = 0
gosub showcursor
at (0,0)
do
get $_key
if asc($_key) = 224 ; Extended Key
get $_key
if asc($_key) = 80 ; Down Arrow
gosub hidecursor
$_currow = $_currow + 1
$_curitem = $_curitem + 1
if $_currow > $_colitems[$_curcol]
$_currow = 0
$_curitem = $_curitem - $_colitems[$_curcol] - 1
endif
gosub showcursor
endif
if asc($_key) = 72 ; Up Arrow
gosub hidecursor
$_currow = $_currow - 1
$_curitem = $_curitem - 1
if $_currow < 0
$_currow = $_colitems[$_curcol]
$_curitem = $_curitem + $_colitems[$_curcol] + 1
endif
gosub showcursor
endif
if asc($_key) = 75 ; Left Arrow
gosub hidecursor
$_curcol = $_curcol - 1
if $_curcol < 0
$_curcol = $_rowitems[$_currow]
$_curitem = $_curitem + $_rowitems[$_currow] * $_rows
else
$_curitem = $_curitem - $_colitems[$_curcol] - 1
endif
gosub showcursor
endif
if asc($_key) = 77 ; Right Arrow
gosub hidecursor
$_prev = $_curcol
$_curcol = $_curcol + 1
if $_curcol > $_rowitems[$_currow]
$_curcol = 0
$_curitem = $_curitem - $_rowitems[$_currow] * $_rows
else
$_curitem = $_curitem + $_colitems[$_prev] + 1
endif
gosub showcursor
endif
endif
until asc($_key) = 13 or asc($_key) = 27 ; ENTER or ESC

if asc($_key) = 13
$kixmenu = $_curitem
else
$kixmenu = -2
endif
return

:showcursor
color b/w+
at ($_currow + $y+1,$_curcol * ($_width + 1) + $x+1) $_array[$_curitem]
color w/n
at (0,0)
return

:hidecursor
color w+/b
at ($_currow + $y+1,$_curcol * ($_width + 1) + $x+1) $_array[$_curitem]
color w/n
at (0,0)
return

endfunction

_________________________
Dean