xBrowse, footer and total dbf records

Post Reply
MOISES
Posts: 824
Joined: Wed Aug 22, 2007 10:09 am

xBrowse, footer and total dbf records

Post by MOISES »

Hello:

I would like to have a footer in xBrowse without column separations with the total number of records in the dbf that will be dynamically updated when records are added or deleted.

Please, how is this done?

Thank you very much.
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: xBrowse, footer and total dbf records

Post by nageswaragunupudi »

APPROACH-1

Code: Select all

#include "fivewin.ch"

REQUEST DBFCDX

function Main()

   local oDlg, oBar, oBrw, oFont

   SET DELETED ON
   USE STATES NEW SHARED

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 400,500 PIXEL TRUEPIXEL FONT oFont
   DEFINE BUTTONBAR oBar OF oDlg SIZE 80,32 2007

   @ 52,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE "STATES" AUTOCOLS ;
      CELL FOOTERS NOBORDER FASTEDIT

   WITH OBJECT oBrw
      :nEditTypes       := EDIT_GET
      :nRowDividerStyle := LINESTYLE_LIGHTGRAY

      :aCols[ 1 ]:bFooter := { || oBrw:nLen }
      :aCols[ 2 ]:cFooter := "States"

      //
      :CreateFromCode()
   END

   // Add,Edit,Delete buttons and actions
   DEFINE BUTTON OF oBar PROMPT "Add"    CENTER ACTION oBrw:EditSource( .t. )
   DEFINE BUTTON OF oBar PROMPT "Edit"   CENTER ACTION oBrw:EditSource()
   DEFINE BUTTON OF oBar PROMPT "Delete" CENTER ACTION oBrw:Delete()
   DEFINE BUTTON OF oBar PROMPT "Close"  CENTER ACTION oDlg:End() GROUP
   //

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil
 
Image

APPROACH-2

Code: Select all

#include "fivewin.ch"

REQUEST DBFCDX

function Main()

   local oDlg, oBar, oBrw, oFont

   SET DELETED ON
   USE STATES NEW SHARED

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 400,500 PIXEL TRUEPIXEL FONT oFont
   DEFINE BUTTONBAR oBar OF oDlg SIZE 80,32 2007

   @ 52,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE "STATES" AUTOCOLS ;
      CELL FOOTERS NOBORDER FASTEDIT

   WITH OBJECT oBrw
      :nEditTypes       := EDIT_GET
      :nRowDividerStyle := LINESTYLE_LIGHTGRAY
      //
      :bRecSelHeader    := { || "RecNo" } // OR { || "SlNo" }
      :bRecSelData      := { || oBrw:BookMark } // OR { || oBrw:KeyNo }
      :bRecSelFooter    := { || oBrw:nLen }
      :nRecSelWidth     := "999"
      //
      :CreateFromCode()
   END

   // Add,Edit,Delete buttons and actions
   DEFINE BUTTON OF oBar PROMPT "Add"    CENTER ACTION oBrw:EditSource( .t. )
   DEFINE BUTTON OF oBar PROMPT "Edit"   CENTER ACTION oBrw:EditSource()
   DEFINE BUTTON OF oBar PROMPT "Delete" CENTER ACTION oBrw:Delete()
   DEFINE BUTTON OF oBar PROMPT "Close"  CENTER ACTION oDlg:End() GROUP
   //

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil
 
Image
Regards

G. N. Rao.
Hyderabad, India
Post Reply