Page 1 of 1

xBrowse method not working

Posted: Mon Feb 26, 2007 8:31 pm
by Ehab Samir Aziz
I tried gotop() method as below but not cause the browse to go top :

Code: Select all

   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
   oBrw:GoTop()


   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,0))
      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 ),oDlg:Refresh(.t.),oBrw:Refresh(.t.))

Re: xBrowse method not working

Posted: Wed Feb 28, 2007 2:46 pm
by Maurilio Viana
Ehab,

Try call go top on 'on init' clause of activate dialog, like:

Code: Select all

ACTIVATE DIALOG oDlg ON INIT (oBrw:SetSize( 1000, 600 ),BuildButtons( oDlg ),oDlg:Refresh(.t.),   oBrw:GoTop(),;  // <-- HERE
 oBrw:Refresh(.t.))
Regards,
Maurilio

Posted: Wed Feb 28, 2007 6:35 pm
by Ehab Samir Aziz
I already tried - not working -

Code: Select all


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 1
USE cust
INDEX ON upper(cust->cu_acct) TO cust
INDEX ON upper(cust->cu_name) TO cust1
INDEX ON upper(cust->cu_coun) TO cust2
INDEX ON upper(cust->cu_city) TO cust3
INDEX ON upper(cust->cu_gove) TO cust4
INDEX ON upper(cust->cu_stre) TO cust5
INDEX ON upper(cust->cu_phon) TO cust6
INDEX ON upper(cust->cu_fax ) TO cust7
INDEX ON upper(cust->cu_mobi) TO cust8
INDEX ON upper(cust->cu_man ) TO cust9
INDEX ON upper(cust->cu_appr) TO cust10
set INDEX TO cust

select 2
USE cont
INDEX ON cont->CT_CU_ACCT+dtoc(cont->ct_strd) TO cont
INDEX ON cont->CT_CU_acct TO cont1
INDEX ON cont->ct_strd TO cont2
INDEX ON cont->ct_endd TO cont3
INDEX ON cont->CT_machno TO cont4
INDEX ON cont->CT_mamc TO cont5
INDEX ON cont->ct_paymet TO cont6
INDEX ON cont->ct_payamt TO cont7
INDEX ON cont->ct_currenc TO cont8
INDEX ON cont->ct_excmet TO cont9
INDEX ON cont->ct_excamt TO cont10
INDEX ON cont->ct_minvol TO cont11
INDEX ON cont->ct_ctna TO cont12
SET INDEX TO cont1

select 3
use mach
index on mach->MC_CU_ACCT to mach
index on UPPER(mach->MC_CU_name) to mach1
index on UPPER(mach->MC_ct_ctna) to mach2
index on UPPER(mach->MC_model) to mach3
index on UPPER(mach->MC_TYPE)+UPPER(mach->MC_model) to mach4
index on (mach->MC_serial) to mach5
index on UPPER(mach->MC_meres) to mach6
index on UPPER(mach->MC_brn) to mach7
index on UPPER(mach->MC_gateway) to mach8
set index to mach5
go top*/

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