#2 is closer, but even that isn't fully compatible, unfortunately I don't
have the time and tech env now to fully oversee the
nPos == 0 case and do extensive side-by-side tests, so rather
than messing up the code, I'd like to ask someone to jump
on this if current state isn't good enough.

Attached new test code with repaint trick copied in.

Brgds,
Viktor

---
#include "inkey.ch"
#include "achoice.ch"

function main()

//NIL, empty, numeric, and not handled - items
//must be inaccesible and invisible
local aMenu1 := {" --Visky--", "", "not handled"}
local aMenu2 := {" --Vodka--", " --Water--", NIL, "not handled"}
local aMenu3 := {" --Grapa--", 33, "not handled"}

local lExit := .F.
local nCounter := 1
local nKeyPressed

setcolor("W+/N, BG+/B, , , W/N")
cls
@ 2,1 SAY " --Visky--   --Vodka--   --Grapa--"
@ 3,14 SAY "--Water--"
do while !lExit

do case
  case nCounter == 1
    achoice(2, 1, 3, 11, aMenu1)
  case nCounter == 2
    achoice(2, 13, 3, 23, aMenu2, .T., "cUserFunction")
  case nCounter == 3
    achoice(2, 25, 3, 35, aMenu3, .T., "cUserFunction")
endcase

nKeyPressed := lastkey()
if nKeyPressed == K_ESC
 lExit := .T.
elseif nKeyPressed == K_RIGHT
 nCounter := iif(nCounter == 3, 1, nCounter+1)
elseif nKeyPressed == K_LEFT
 nCounter := iif(nCounter == 1, 3, nCounter-1)
endif

enddo

return NIL

//do nothing, just for test
function cUserFunction( nMode, nCurElement, nRowPos )

local nRetVal := AC_CONT
local nKey := LASTKEY()

dispbox( 0, 0, maxrow(), maxcol(), repl("#",9), "GR+/G" )

if nMode == AC_NOITEM
 nRetVal := AC_ABORT
elseif nMode == AC_EXCEPT
 do case
   case nKey == K_RETURN
     nRetVal := AC_SELECT
   otherwise
     nRetVal := AC_ABORT
 endcase
endif


return nRetVal
---

On Thu, Mar 12, 2009 at 2:51 PM, Przemyslaw Czerpak <[email protected]>wrote:

> On Thu, 12 Mar 2009, Szak�ts Viktor wrote:
> > > Variant - 2
> > > Delete all previously posted
> > >  DispPage( acItems, alSelect, nTop, nLeft, nRight, nNumRows, 0, nAtTop,
> > > nItems, bSelect, nRowsClr )
> > > lines
> > > and add in all CASE entry before lFinished := .T. (7-lines) and before
> nPos
> > > := 0 (if exist)
> > > [...]
> > > +       DispLine( acItems[ nPos ], nTop + ( nPos - nAtTop ), nLeft,
> .T.,
> > > .F., nNumCols )
> > >      nPos      := 0
> > >      lFinished := .T.
> > > [...]
> > > add 7 lines of code, but redraw only one current line
> > > I test both (OK), with extended (added NIL, EMPTY, NUMERIC array
> values,
> > > and UserFunction) previously posted
> > Variant #2 seems more optimal, as it only redraws one item,
> > not the whole page. Question what happens when nPos is zero
> > at this point, can it happen?
>
> Maybe we should simply test what Clipper does?
> F.e. overwrite the whole screen in user function
>
>   dispbox( 0, 0, maxrow(), maxcol(), repl("#",9), "GR+/G" )
>
> and check what Clipper redraws for different return values,
> also non numeric ones.
>
> best regards,
> Przemek
> _______________________________________________
> Harbour mailing list
> [email protected]
> http://lists.harbour-project.org/mailman/listinfo/harbour
>
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to