Page 1 of 1

xBrowse Database fields

Posted: Fri Nov 02, 2007 5:42 pm
by Ehab Samir Aziz
What method to be used to choose certain fields in certain order to browse using xbrowse.

Code: Select all

method browser()

   local oDlg,oBrw,oMeter,oFont,oCol,nFor,oChild

   ::setOrder(2)
   ::gotop()


   define font oFont name "Ms Sans Serif" size 0,-14 BOLD

   DEFINE DIALOG oDlg 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:CreateFromCode()
   oBrw:nTop = 0
   oBrw:nLeft = 0
   oBrw:nWidth = 1000
   oBrw:nHeight =600
   oBrw:SetRDD()
   


      for nFor := 1 to ::Fcount()
      	oBrw:aCols[ nFor ]:oDataFont := oFont
      next
    
   // Setup for using database class
   oBrw:cAlias:= ::cAlias
   oBrw:bSkip:= {|nRecs| ::skipper( nRecs ) }
   oBrw:bGotop:= {|| ::gotop() }
   oBrw:bGoBottom:= {|| ::goBottom() }
   oBrw:bBookMark := {| n | iif( n == nil, ::RecNo() , ::Goto( n ) ) }
   

oMeter:= self

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






RETURN nil

Posted: Fri Nov 02, 2007 6:35 pm
by Otto
Hello Ehab,
maybe this can help you.

http://fivetechsoft.com/forums/viewtopic.php?t=8684

Posted: Sat Nov 03, 2007 10:43 am
by Ehab Samir Aziz
No I mean to force fields from a database using code and fix (always) browse .
Thanks

Posted: Sat Nov 03, 2007 12:43 pm
by Otto
I don’t know if I understand you well.

Do you mean you want selected fields of a dbf file not all and these in a certain order.

Then you have to use not:
oBrw:SetRDD()
for nFor := 1 to ::Fcount()
oBrw:aCols[ nFor ]:oDataFont := oFont
next

but for every field you want something like this:

oBrw:nRowHeight := 18
// 2
oCol := oBrw:AddCol()
oCol:cHeader := "LAST"
oCol:bStrData := { || _FIELD->LAST}
oCol:nWidth := 146
// 1
oCol := oBrw:AddCol()
oCol:cHeader := "FIRST"
oCol:bStrData := { || _FIELD->FIRST}
oCol:nWidth := 146