* source/rtl/achoice.prg

! Reduce redundant code.
  ! Fix default values of nBottom and nRight out of range.
  ! Add control of value of nBottom and nRight.
This commit is contained in:
Walter Negro
2002-10-22 02:23:58 +00:00
parent eb0e0d8185
commit 007650bc26

View File

@@ -55,23 +55,23 @@ FUNCTION AChoice( nTop, nLeft, nBottom, nRight, acItems, xSelect, xUserFunc, nPo
DEFAULT nTop TO 0 // The topmost row of the window
DEFAULT nLeft TO 0 // The leftmost column of the window
DEFAULT nBottom TO MaxRow() + 1 // The bottommost row of the window
DEFAULT nRight TO MaxCol() + 1 // The rightmost column of the window
DEFAULT nBottom TO MaxRow() // The bottommost row of the window
DEFAULT nRight TO MaxCol() // The rightmost column of the window
DEFAULT acItems TO {} // The items from which to choose
DEFAULT xSelect TO .T. // Array or logical, what is selectable
DEFAULT nPos TO 1 // The number of the selected item
DEFAULT nHiLiteRow TO 0 // The row to be highlighted
IF nRight == 79 .and. nLeft ==0
nNumCols := 80
ELSE
nNumCols := nRight - nLeft + 1
nNumCols := nRight - nLeft + 1
IF nRight > MaxCol()
nRight := MaxCol()
ENDIF
IF nRight > MaxCol()
nRight--
IF nBottom > MaxRow()
nBorrom := MaxRow()
ENDIF
nNumRows := nBottom - nTop + 1
@@ -507,16 +507,9 @@ STATIC PROCEDURE DispPage( acItems, alSelect, nTop, nLeft, nRight, nNumRows, nPo
LOCAL nIndex // Array index
LOCAL nSaveRow := Row() // Position at start of routine
LOCAL nSaveCol := Col() // Position at start of routine
LOCAL nRightPos := 0
Default nRowsClr to nNumRows
IF nRight == 79 .and. nLeft == 0
nRightPos := 80
ELSE
nRightPos := nRight - nLeft + 1
ENDIF
DispBegin()
FOR nCntr := 1 TO Min( nNumRows, nRowsClr )