How can I do this in GUI style ?

How can I do this in GUI style ?

Postby HunterEC » Mon Aug 19, 2013 6:40 pm

Guys:

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
 
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: How can I do this in GUI style ?

Postby nageswaragunupudi » Mon Aug 19, 2013 8:30 pm

You may try using this function in the place of AChoice

Code: Select all  Expand view

function XChoice( aPrompts, cTitle )

   local nSelect  := 0

   DEFAULT cTitle := "Select"

   XBROWSER aPrompts TITLE cTitle SELECT ( nSelect := oBrw:nArrayAt ) ;
      SETUP ( oBrw:lHeader := .f., oBrw:lRecordSelector := .f., oBrw:lHScroll := .f., ;
      oBrw:oWnd:bInit := { |oDlg| oDlg:aControls[ 1 ]:Hide(), oDlg:aControls[ 2 ]:Hide() } )

return nSelect
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10306
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: How can I do this in GUI style ?

Postby HunterEC » Mon Aug 19, 2013 11:08 pm

Rao:

Great job ! Thank you very much.
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 55 guests