FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour where to place gotop() in xbrowse
Posts: 334
Joined: Fri Oct 14, 2005 01:54 PM
where to place gotop() in xbrowse
Posted: Thu Mar 01, 2007 04:29 PM
Where should I place xBrw:gotop() inside xbrowse . That code below is not causing the xbrowse to go top xBrw:pageup() is working but not my demand .
STATIC FUNCTION listmete( oWnd ) 
*-------------------------- 

local oDlg, oCol 
local nTotal:=0 

local oBrw 
local nfor,cFilter:="",bFilter:="" 
local y 
local V_me_mc_serl:= space(7) 

REQUEST ADS 
rddRegister( "ADS", 1 ) 
rddsetdefault( "ADS" ) 
AdsSetDeleted(.T.) 
SET SERVER LOCAL 
SET FILETYPE TO CDX 


select 4 
use mete 
index on mete->ME_mc_serl to mete 
index on str(mete->year) + str(mete->month) to mete1 
index on mete->me_date to mete2 
set index to mete 


if MsgGet( "Serial Machine", "Enter Serial Machine", @V_me_mc_serl,; 
              "..\lupa.bmp" ) 
      select 3 
      use mach 
      set index to mach5 
      *MSGINFO(IndexKey()) 
      if ! DbSeek( (V_me_mc_serl )) 
         MsgAlert( "I don't find that serial" ) 
      endif 
   endif 



y := "'"+padr(V_me_mc_serl,7)+"'" 
cFilter := "me_mc_serl = "+ y 
bFilter = "{||"+cFilter+"}" 



select 4 
use mete 
DBSETFILTER(&bFilter,cFilter) 
mete->(DBGOTOP()) 

   DEFINE DIALOG oDlg of oWnd FROM 0,0 TO 45,128 TITLE "Meter reads browse " 

   oBrw := TXBrowse():New( oDlg ) 
   oBrw:nMarqueeStyle       := MARQSTYLE_HIGHLCELL 
   oBrw:nColDividerStyle    := LINESTYLE_BLACK 
   oBrw:nRowDividerStyle    := LINESTYLE_BLACK 
   oBrw:lColDividerComplete := .t. 
   oBrw:nHeaderLines        := 1 
   oBrw:nFooterLines        := 1 
   oBrw:nDataLines          := 1 
   oBrw:lFooter             := .t. 
   oBrw:SetRDD() 
   oBrw:CreateFromCode() 
   oBrw:nTop = 0 
   oBrw:nLeft = 0 
   oBrw:nWidth = 1000 
   oBrw:nHeight =600 



   for nFor := 1 to Fcount() 

*oBrw:aCols[ nFor ]:cFooter       := alltrim(STR(TOTALEM2(V_me_mc_serl),12,0)) 

   if nFor=27 
      oBrw:aCols[ nFor ]:cHeader       := FieldName( nFor ) 
      oBrw:aCols[ nFor ]:cFooter       := alltrim(STR(TOTALEM2(),12,2)) 
      loop 
   endif 

      *oBrw:aCols[ nFor ]:cHeader       := FieldName( nFor ) 
      *oBrw:aCols[ nFor ]:cFooter       := FieldName( nFor ) 
   next 

    
   oBrw:Refresh(.t.)            // Repaint the ListBox 





ACTIVATE DIALOG oDlg ON INIT (oBrw:SetSize( 1000, 600 ),BuildButtons( oDlg ),oBrw:gotop(),oBrw:Refresh(.t.),oDlg:Refresh(.t.)) 

RETURN NIL
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
where to place gotop() in xbrowse
Posted: Thu Mar 01, 2007 05:26 PM
Ehab,

Here are some things to try.

You shouldn't use the alias name in indexes.

I see that you are opening two files and not specifying the alias in the browse definition. Try adding this:

oBrw:="mete"

Also, it appears that you open mete, index it, then reopen it (causing the indexes to be closed) and you don't reopen the indexes.

I don't know why you would even need to issue a oBrw:gotop() since the database should already be there. I would try checking right after this code:

select 4
use mete
DBSETFILTER(&bFilter,cFilter)
mete->(DBGOTOP())

msgInfo( [put field name here] )

If you are not at the top record here, then it has nothing to do with the browse.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
where to place gotop() in xbrowse
Posted: Thu Mar 01, 2007 05:27 PM

Ehab,

Please understand what means a small and self contained sample to test.

We don't have your DBFs, and we can not build your portion of code. In order to provide tech support, you have to provide a small and self contained sample that reproduces the error to fix. Thanks,

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion