Page 1 of 1

Problem when refreshing BROWSE

Posted: Fri Jul 25, 2008 4:49 am
by xProgrammer
Hi Antonio

I have had trouble trying to refresh BROWSEs. I can get the additional data painted OK on the screen but the navigation doesn't work correctly. I have reproduced the problem in this sample (modified from testbrow.prg)

Code: Select all

#include "FiveLinux.ch"

function Main()

PUBLIC aFIRST
PUBLIC aSECOND
PUBLIC oBrw
PUBLIC oWnd

   aFIRST := { 1, 2 }
   aSECOND := { "one", "two" }

   DEFINE WINDOW oWnd TITLE "Testing Browses" SIZE 522, 317

   @ 2, 2 BROWSE oBrw OF oWnd ;
      HEADERS "First", "Second" ;
      FIELDS  aFIRST[oBrw:nAt], aSECOND[oBrw:nAt] ;
      UPDATE
      
   oBrw:SetArray( aFIRST )

   @ 28, 2 BUTTON "_Add" OF oWnd ACTION AddToBrowse()
   @ 28, 12 BUTTON "_Ok" OF oWnd ACTION oWnd:End()

   ACTIVATE WINDOW oWnd

return nil

FUNCTION AddToBrowse()

AAdd( aFIRST, 3 )
AAdd( aFIRST, 4 )
AAdd( aFIRST, 5 )
AAdd( aSECOND, "three" )
AAdd( aSECOND, "four" )
AAdd( aSECOND, "five" )
oBrw:SetArray( aFIRST )
oWnd:Refresh()

RETURN nil
./buildx.sh xPtestbrow then click the Add button the additional rows will display OK but if you click on row 4 the highlight goes to row 5 click on row 2 and it will go to row 1 but then click on row 3 and it will go there. The problem seems to occur whenever you add rows to an existing BROWSE.

Maybe I am doing something wrong or failing to do something I should be doing. Please advise.

Thanks
Doug
(xProgrammer)