I've got an old Clipper 5.2e / DOS text routine that receives an array of indexes and builds a small ACHOICE() index / order selection screen.
The window growse or shrinks depending on the number of array elements. How can I get the same functionality in GUI ? Thank you.
Here's the code:
- Code: Select all Expand view
FUNCTION RepOrder (acOrder)
LOCAL GetList := {}, nOldWindow, nWindow, nMaxLength := 0, nMaxCol, ;
nLeft, nRight, nWindSel := Sx_TagNo(), cOrder
nOldWindow := WSELECT()
WSELECT(0)
AEVAL(acOrder, {|cIndex| nMaxLength := MAX(LEN(cIndex), nMaxLength)})
nMaxCol := MAXCOL()
IF nMaxLength >= nMaxCol - 4
nMaxLength := nMaxCol - 4
ELSE
nMaxLength += 4
ENDIF
nLeft := INT((nMaxCol - nMaxLength) / 2)
nRight := nLeft + nMaxLength
nWindow := WOPEN(09,nLeft,MIN(MAXROW(), 12 + LEN(acOrder)),nRight)
SETCOLOR("GR+/BG+,BG+/N,,,GR/B")
WBOX()
@ 0,0 SAY CENTER("Order",,, .T.) COLOR "GR+/BR+"
@ 1,0 TO 1,MAXCOL()
nWindSel := ACHOICE(2,1,MAXROW(),MAXCOL() - 1,acOrder, .T., , nWindSel)
IF nWindSel > 0
cOrder := acOrder[nWindSel]
IF nWindSel != Sx_Tagno()
ORDSETFOCUS(nWindSel)
ENDIF
ENDIF
WCLOSE()
WSELECT(nOldWindow)
RETURN (cOrder)
// EOF: RepOrder