Page 1 of 1
xBrowse, footer and total dbf records
Posted: Tue Dec 24, 2019 5:41 pm
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.
Re: xBrowse, footer and total dbf records
Posted: Wed Dec 25, 2019 5:10 am
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
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