TXBrowse():Refresh() will Scroll Up 1 line

Post Reply
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

TXBrowse():Refresh() will Scroll Up 1 line

Post by dutch »

Dear Antonio,

I use xHB.com Nov '07 with FWH 8.03.

When I put method TXBrowse():Refresh() the screnn will scroll up 1 line!. I feel every update data TXBrowse() will automatic :Refresh() even do not call :Refresh().

Do I understand correctly? If so, I have to remove very in the program ::Refresh()? Because when I call it TXBrowse() will alway scroll up 1 line.

Regards,
Dutch
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Dutch,

Can we see how you have defined the browse?

James
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

>
I feel every update data TXBrowse() will automatic :Refresh() even do not call :Refresh().
>
No. It does not. If a cell is edited through xBrowse's methods, then that row only is refreshed automatically using the method DrawLine( .t. ). Also if we use xBrowse's inbuilt feature to sort columns and the edited column is a sorted column, then the browse calls Refresh() automatically instead of DrawLine( .t. ).

If we update the data directly then we need to refresh() or drawline(.t.) ourselves.
( Note: To refesh a single row, we can either use DrawLine( .t. ) or DrawSelect() or RefreshCurrent() in the latest version of xBrowse )
>
When I put method TXBrowse():Refresh() the screnn will scroll up 1 line!
>
This is surprising. I never noticed it so far. I am very much interesed in knowing under what circumstances this happens.
Regards

G. N. Rao.
Hyderabad, India
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Post by dutch »

Dear James,

This is my REDEFINE command. I try many time with :Refresh() at ON DBLCLICK, after edit the record and save the record will scroll up 1 line. If I remove :Refresh() and save. The record is refreshing and still the current line.

Code: Select all

   REDEFINE XBROWSE oTbw FIELDS    TBL->TBL_RMNO, ;
                                   TBL->TBL_RMTY, ;
                                   strim(TBL->TBL_NUMRM,3), ;
                                   strim(TBL->TBL_COVER,3),;
                                   iif(!empty(MSS->MSG_INTNO),hMsgBmp,''), ;
                                 TBL->(RsGstName(TBL->TBL_NAT,25)), ;
                                 GST->GST_GSTYPE,;
                                 dtoc(TBL->TBL_ARR),;
                                 dtoc(TBL->TBL_DEP),;
                                 left(TBL->TBL_GROUP,10),;
                                 left(TBL->TBL_COM,14), ;
                                 iif(val(TBL->TBL_SHRNO)>0,hShrBmp,''), ;
                                 iif(TBL->TBL_WAIT='W',hWaiBmp,''), ;
                                 TBL->TBL_RMK, ;
                                 TBL->TBL_ARFLT, ;
                                 TBL->TBL_ARTIME, ;
                                 TBL->TBL_DPFLT, ;
                                 TBL->TBL_DPTIME ;
            ALIAS 'TBL' ;                                 
            FIELDSIZES 50, 40, 33, 33, 30, 150, 35, 65, 65, 85, 85, 35, 35, 250, 70, 55, 70, 55 ;
            JUSTIFY     0,2,2,2,2,0,2,0,0,0,0,2,2,0,2,2,2,2 ;
            HEADERS    TE('àÅ¢Ëéͧ','Room#'), TE('»À.Ëéͧ','RmTy'), TE('Ëéͧ','Rms'), ;
                       TE('ᢡ','Gst'), TE('¨´ËÁÒÂ','Msg'), TE('ª×èÍᢡ','Guest name'), TE('ᢡ','Type'), ;
                       TE('Çѹà¢éÒ','Arrival'), TE('ÇѹÍÍ¡','Departure'), ;
                       TE('¡ÃØê»','Group'), TE('ºÃÔÉÑ·','Company'), TE('¾Ñ¡ÃèÇÁ#','Share#'), TE('ÃÍ','Wait'), TE('ËÁÒÂà˵Ø','Remarks'), ;
                       TE('à·ÕèÂÇà¢éÒ','Arr.Flight'), TE('àÇÅÒà¢éÒ','Arr.Time'), ;
                       TE('à·ÕèÂÇÍÍ¡','Dep.Flight'), TE('àÇÅÒÍÍ¡','Dep.Time') ;
              ID 130 ;
              OF rDlg ;
              ON DBLCLICK (RsvnScr(.F.,,oDbf),oTbw:Refresh(), oTbw:SetFocus())  

   oTbw:nMarqueeStyle   := MARQSTYLE_HIGHLROW
   oTbw:nRowDividerStyle:= LINESTYLE_LIGHTGRAY
   oTbw:nColDividerStyle:= LINESTYLE_LIGHTGRAY
   oTbw:nHeaderHeight   := 24
   oTbw:nRowHeight      := 20
  
   // oTbw:lRecordSelector := .F.
   // oTbw:l2007 := .T.
   
   oTbw:bClrStd  := {|| { iif( GST->GST_GSTYPE='V' , CLR_HRED , CLR_BLACK ), GetSysColor( 5 )  } }  
   oTbw:lFooter  := .T.
   
   oTbw:aCols[3]:bFooter     := { || nTlRms }
   oTbw:aCols[3]:lTotal      := .t.
    
   oTbw:aCols[4]:bFooter     := { || nTlGst }
   oTbw:aCols[4]:lTotal      := .t.
   

   oTbw:bChange  := { || rDlg:aEvalWhen(), rDlg:Update(), ReBtn1(lMainMenu,oBtn) }

   oTbw:bKeyChar := { | nKey | ( IIF(nKey = VK_RETURN, RsvnScr(.F.,,oDbf) , )) }
   
   oTbw:bKeyDown := { | nKey | ( IIF(nKey = VK_INSERT, RsvnScr(.T.,,oDbf) , ;
                                 IIF(nKey = VK_DELETE, (CancelRs( oTbw, oDbf ), oTbw:GoTop()) , ) ) , ;
                                                       oTbw:SetFocus() ) }  // oTbw:Refresh(), 
                                                         
   oTbw:bLClicked := { | nRow, nCol, nFlags | if(oTbw:nAt()=12 .and. !empty( TBL->TBL_SHRNO ), ShowShare(), ;
                                              if(oTbw:nAt()=13 .and. TBL->TBL_STATUS='R' .and. UserRights(37,.F.), ( WaitList() ) , ;  // , oTbw:Refresh()
                                                ) ) }
   
   oTbw:bRClicked := { | nRow, nCol, nFlags | ( oTbw:SetFocus(), oTbw:lButtonDown(nRow,nCol), RsvnMenu( nRow, nCol, rDlg, oTbw, oBtn, oDbf, oComDbf, lGrpOpt ) ) }

   oTbw:aCols[5]:AddResource("MSG")
   oTbw:aCols[5]:bBmpData   := { || iif(!empty(MSS->MSG_INTNO) , 1, 0) }
   oTbw:aCols[5]:nDataBmpAlign := AL_CENTER
   
   oTbw:aCols[12]:AddResource("SHARE")
   oTbw:aCols[12]:bBmpData   := { || iif(val(TBL->TBL_SHRNO)>0 , 1, 0) }
   oTbw:aCols[12]:nDataBmpAlign := AL_CENTER
   
   oTbw:aCols[13]:AddResource("WAIT")
   oTbw:aCols[13]:bBmpData   := { || iif( TBL->TBL_WAIT='W' , 1, 0) }
   oTbw:aCols[13]:nDataBmpAlign := AL_CENTER
Regards,
Dutch
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Dutch,

I am wondering if something in this function is causing the problem:

RsvnScr(.F.,,oDbf)

If you remove the call to that function does the browse still move up one record?

James
Post Reply