On Thu, 04 Feb 2010, smu johnson wrote:

Hi,

> Hi Przemek.  Thank you for replying.  We found one more possibly easy fix
> (maybe) while you are fixing this minor bug for ACHOICE.  I got this over
> MSN, maybe you can figure out what it means better than me.
> (11:01:46 AM) MN: Also on the subject of ACHOICE()... In Harbour, achoice()
> restores the row() to where it was when achoice() started. In Clipper it
> leaves the Row() at wherever achoice() happened to moved it... causing
> cursor position disasters in the console-based program.

To be more precise. Harbour does not touch cursor position at all
and Clipper moves cursor to position corresponding to displayed data.
This code nicely shows it and also some other incompatibilities:

   #include "achoice.ch"
   proc main()
      local nPos, nRow, nCol
      dispbox( 0, 0, maxrow(), maxcol(), repl( "#", 9 ) )
      nPos := AChoice( 1, 2, 10, 20, { "I1", "I2", "I3", "I4" }, ;
                                     { .t., .t., .f., .t. }, "achoicef" )
      nRow := row(); nCol := col()
      setpos( 12, 0 )
      ?? nRow, nCol, nPos
   return
   func achoicef( nMode, nItem )
      local nRow := row(), nCol := col()
      setpos( nRow, 35 )
      ?? nRow, nCol, nMode, nItem
   return AC_CONT

but it's not a problem to find some differences and fix them when
someone reports the problem. In such way it's impossible to create
really good emulation because after some time new fixes breaks some
other things tested before. It can be very well seen in xHarbour's
TBROWSE code. It has been systematically modified for last the last 7
years and still it does not work correctly and it's far to be Clipper
compatible, i.e. test it using tests/tb1.prg.
If you do not want to create such never ending story then it's necessary
to create man difference code examples like above and document exact
ACHOICE behavior for different situations and parameters (also wrong
ones). When you collect complete information about expected behavior
and undocumented side effects then you can create the code. During
tests I strongly suggest to not take any solutions from existing code
because they can be wrong.
ACHOICE is not very complicated thing. If someone really wants to
write good replacement then I think two days is enough for tests
and coding.

best regards,
Przemek
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to