Viktor Szakáts wrote:
Thanks, I'll commit this in next session.

Brgds,
Viktor

On Wed, Mar 11, 2009 at 9:55 AM, Vladislav Lavrecky <[email protected] <mailto:[email protected]>> wrote:

    Vladislav Lavrecky wrote:

        Przemyslaw Czerpak wrote:

            On Wed, 11 Mar 2009, Vladislav Lavrecky wrote:

            Hi,

                achoice with additional redraw on exit are ok
                I test it previously, but in my message just an example
                To fix achoice we need to add
                +   DispPage( acItems, alSelect, nTop, nLeft, nRight,
                nNumRows, 0, nAtTop, nItems, bSelect, nRowsClr )
                in all CASE items where lFinished := .T.
                or IMO better
                add one redraw line before exit from achoice function
                [...]
                 ENDDO
                +   DispPage( acItems, alSelect, nTop, nLeft, nRight,
                nNumRows, 0, nAtTop, nItems, bSelect, nRowsClr )
                 SetCursor( nSaveCsr )

                 RETURN nPos
                [...]

            Can you create a small .prg example which illustrates
            achoice()
            incompatibilities?
            We can put it in tests/ directory so it can be used to verify
            future modifications.

            best regards,
            Przemek
            _______________________________________________
            Harbour mailing list
            [email protected]
            <mailto:[email protected]>
            http://lists.harbour-project.org/mailman/listinfo/harbour

        Hi,
        small example :)

        function main()

        local aMenu := {"Line1" , "Line2" , "Line3"}
        local aPerm := {.T. , .T. , .T.}

        cls
        setcolor("W+/N, BG+/B, , , W/N")
        achoice(8, 4, 9, 9, aMenu, aPerm)

        return NIL

        Clipper on exit (press ESC, ENTER, ...) redraw achoice() with
        no highlighted items

        brgds,
        Vlad

    By the way
    I fouund one more clipper-harbour achoice() incompatibility
    example
    ------
    function main()

    local aMenu := {"Line1" , "" , "Line3"}

    local aPerm := {.T. , .T. , .T.}

    cls
    setcolor("W+/N, BG+/B, , , W/N")
    achoice(8, 4, 9, 9, aMenu, aPerm)

    return NIL
    ------
    Clipper show only one item - Line1
    Harbour - all three lines

    this can be fixed in achoice.prg
    in function Ach_Limits chahge IF clause from
        IF ISCHARACTER( acItems[ nCntr ] )
    to
        IF LEN( acItems[ nCntr ] ) > 0 .AND. ISCHARACTER( acItems[
    nCntr ] )


    Brgds,
    Vlad


        _______________________________________________
        Harbour mailing list
        [email protected] <mailto:[email protected]>
        http://lists.harbour-project.org/mailman/listinfo/harbour



    _______________________________________________
    Harbour mailing list
    [email protected] <mailto:[email protected]>
    http://lists.harbour-project.org/mailman/listinfo/harbour


------------------------------------------------------------------------

_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour
Sorry I make dangerous mistake in
IF LEN( acItems[ nCntr ] ) > 0 .AND. ISCHARACTER( acItems[ nCntr ] )
code not safe for NIL values

this look like safe fix
------------
STATIC FUNCTION Ach_Limits( nFrstItem, nLastItem, nItems, bSelect, alSelect, acItems )

  LOCAL nMode
  LOCAL nCntr
//add code block
+  LOCAL bItemsBlock := { |nINum| IIF( ISCHARACTER( acItems[ nINum ]), ;
+                             LEN( acItems[ nINum ] ) > 0, .F. ) }

  nItems := 0

  FOR nCntr := 1 TO Len( acItems )
//replace
- IF LEN( acItems[ nCntr ] ) > 0 .AND. ISCHARACTER( acItems[ nCntr ] )
//with
+      IF EVAL( bItemsBlock, nCntr )
        nItems++
     ELSE
        EXIT
     ENDIF
  NEXT

--------------
[...]


tested on
------------
function main()

local aMenu := {"Line1" , NIL, "", "Line4"}
local aPerm := {.T. , .T. , .T., .T.}

cls
setcolor("W+/N, BG+/B, , , W/N")
achoice(8, 4, 9, 9, aMenu, aPerm)

return NIL

-----------

_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to