A xBrw-sample how to compare filesections ( statistic )
Posted: Sat Sep 21, 2019 2:06 pm
Hello,
working on a statistic-section I created a sample
using file customer.dbf
REQUIREMENTS :
A xBrowse splitted in 3 horizontal sections
a filter ( range ) for each section
incremental seek inside each section
columns must run synchron
only one header and one horizontal-scrollbar
now I can compare the different sections
using just one browser, it is not possible.
As well splitting a big file in 3 pieces.
maybe something useful
regards
Uwe
working on a statistic-section I created a sample
using file customer.dbf
REQUIREMENTS :
A xBrowse splitted in 3 horizontal sections
a filter ( range ) for each section
incremental seek inside each section
columns must run synchron
only one header and one horizontal-scrollbar
now I can compare the different sections
using just one browser, it is not possible.
As well splitting a big file in 3 pieces.
maybe something useful
Code: Select all
FUNCTION FUNCTIONS10( oSystem, nColorF )
LOCAL oFont, oFont1, oFontG, oBrw1, oBrw2, oBrw3, oSay[3]
LOCAL oGet, oBtn1, oTabs1
DEFINE FONT oFont NAME "Arial" SIZE 0,-12
DEFINE FONT oFont1 NAME "Segoe UI Light" SIZE 0,-24
c_path := cFilePath(GetModuleFileName( GetInstance() ) )
c_path1 := c_path + "BITMAPS\"
aValues := READ_INI1(c_path)
oCust := TDatabase():Open( , "CUSTOMER", "DBFCDX", .T. )
// CreateIndex( cFile, cTag, cKey, lUnique, lDescend, lMemory )
oCust:CreateIndex( "CUSTOMER", "CUST1", "Age", .F. )
oCust:Close()
oCust1 := TDatabase():Open( , "CUSTOMER", "DBFCDX", .T. )
oCust1:SetOrder( "CUST1", "Customer" )
oCust2 := TDatabase():Open( , "CUSTOMER", "DBFCDX", .T. )
oCust2:SetOrder( "CUST1", "Customer" )
oCust3 := TDatabase():Open( , "CUSTOMER", "DBFCDX", .T. )
oCust3:SetOrder( "CUST1", "Customer" )
DEFINE DIALOG oDlg SIZE 850, 520 PIXEL TRUEPIXEL ;
TITLE "Compare data" ;
COLOR CLR_BLACK, aValues[1] // 14606046
// ---- 1. section -----
oCust1:ORDSCOPE(0, NIL ) // reset
oCust1:ORDSCOPE(1, NIL ) // reset
oCust1:ORDSCOPE(0, 20 ) // set top scope
oCust1:ORDSCOPE(1, 40 ) // set bottom scope
oCust1:GoTop()
@ 10, 20 XBROWSE oBrw1 SIZE 690, 170 PIXEL OF oDlg ;
DATASOURCE oCust1 ;
AUTOSORT FOOTERS ;
COLUMNS "First", "Last", "State", "City", "Age", "Salary", "Married", "HireDate" ;
HEADERS "First","Last", "State", "City", "Age", "Salary", "Married", "HireDate" ;
COLSIZES 80, 115, 50, 130, 50, 80, 50, 80
oBrw1:nMarqueeStyle := MARQSTYLE_HIGHLCELL
oBrw1:nColDividerStyle := LINESTYLE_BLACK
oBrw1:nRowDividerStyle := LINESTYLE_BLACK
WITH OBJECT oBrw1
:lHeader := .T.
:nHeaderHeight := 26
:lFooter := .F.
:lHScroll := .F.
:lSeekWild := .T.
:CreateFromCode()
END
@10, 730 SAY oSay[1] PROMPT "Age " + CRLF + "20 - 40" SIZE 80, 60 OF oDlg COLOR 255 PIXEL
oSay[1]:lTransparent := .T.
oSay[1]:SetFont(oFont1)
@ 85, 730 SAY oBrw1:oSeek PROMPT oBrw1:cSeek SIZE 50, 20 PIXEL ;
OF oDlg COLOR CLR_BLACK,CLR_YELLOW PICTURE '@!'
// ---- 2. section -----
oCust2:ORDSCOPE(0, NIL ) // reset
oCust2:ORDSCOPE(1, NIL ) // reset
oCust2:ORDSCOPE(0, 41 ) // set top scope
oCust2:ORDSCOPE(1, 60 ) // set bottom scope
oCust2:GoTop()
@ 187, 20 XBROWSE oBrw2 SIZE 690, 145 PIXEL OF oDlg ;
DATASOURCE oCust2 ;
AUTOSORT FOOTERS ;
COLUMNS "First", "Last", "State", "City", "Age", "Salary", "Married", "HireDate" ;
HEADERS "First","Last", "State", "City", "Age", "Salary", "Married", "HireDate" ;
COLSIZES 80, 115, 50, 130, 50, 80, 50, 80
oBrw2:nMarqueeStyle := MARQSTYLE_HIGHLCELL
oBrw2:nColDividerStyle := LINESTYLE_BLACK
oBrw2:nRowDividerStyle := LINESTYLE_BLACK
WITH OBJECT oBrw2
:lHeader := .F.
:lFooter := .F.
:lHScroll := .F.
:lSeekWild := .T.
:CreateFromCode()
END
@187, 730 SAY oSay[2] PROMPT "Age " + CRLF + "41 - 60" SIZE 80, 60 OF oDlg COLOR 255 PIXEL
oSay[2]:lTransparent := .T.
oSay[2]:SetFont(oFont1)
@ 265, 730 SAY oBrw2:oSeek PROMPT oBrw2:cSeek SIZE 50, 20 PIXEL ;
OF oDlg COLOR CLR_BLACK,CLR_YELLOW PICTURE '@!'
// ---- 3. section -----
oCust3:ORDSCOPE(0, NIL ) // reset
oCust3:ORDSCOPE(1, NIL ) // reset
oCust3:ORDSCOPE(0, 61 ) // set top scope
oCust3:ORDSCOPE(1, 90 ) // set bottom scope
oCust3:GoTop()
@ 337, 20 XBROWSE oBrw3 SIZE 690, 162 PIXEL OF oDlg ;
DATASOURCE oCust3 ;
AUTOSORT FOOTERS ;
COLUMNS "First", "Last", "State", "City", "Age", "Salary", "Married", "HireDate" ;
HEADERS "First","Last", "State", "City", "Age", "Salary", "Married", "HireDate" ;
COLSIZES 80, 115, 50, 130, 50, 80, 50, 80
oBrw3:nMarqueeStyle := MARQSTYLE_HIGHLCELL
oBrw3:nColDividerStyle := LINESTYLE_BLACK
oBrw3:nRowDividerStyle := LINESTYLE_BLACK
WITH OBJECT oBrw3
:lHeader := .F.
:lFooter := .F.
:lSeekWild := .T.
:CreateFromCode()
END
@337, 730 SAY oSay[3] PROMPT "Age " + CRLF + "61 - 80" SIZE 80, 60 OF oDlg COLOR 255 PIXEL
oSay[3]:lTransparent := .T.
oSay[3]:SetFont(oFont1)
@ 410, 730 SAY oBrw3:oSeek PROMPT oBrw3:cSeek SIZE 50, 20 PIXEL ;
OF oDlg COLOR CLR_BLACK,CLR_YELLOW PICTURE '@!'
oBrw1:lColChangeNotify := .t.
oBrw1:bGotFocus := { || SyncBrowses( oBrw1, oBrw2, oBrw3 ) }
oBrw1:bChange := { || If( oBrw1:lFocused, SyncBrowses( oBrw1, oBrw2, oBrw3 ), nil ) }
oBrw2:lColChangeNotify := .t.
oBrw2:bGotFocus := { || SyncBrowses( oBrw2, oBrw1, oBrw3 ) }
oBrw2:bChange := { || If( oBrw2:lFocused, SyncBrowses( oBrw2, oBrw1, oBrw3 ), nil ) }
oBrw3:lColChangeNotify := .t.
oBrw3:bGotFocus := { || SyncBrowses( oBrw3, oBrw1, oBrw2 ) }
oBrw3:bChange := { || If( oBrw3:lFocused, SyncBrowses( oBrw3, oBrw1, oBrw2 ), nil ) }
@ 465, 750 BTNBMP oBtn1 OF oDlg ;
SIZE 80, 40 PIXEL 2007 ; // B / H
PROMPT "&Exit" ;
FILENAME c_path1 + "Exit.Bmp" ;
ACTION oDlg:End() ;
FONT oFont ;
LEFT
oBtn1:bClrGrad = { | lMouseOver | If( ! lMouseOver,;
{ { 0.5, 10526975, 16777215 }, ;
{ 0.5, 16777215, 10526975 } }, ;
{ { 0.5, 16768185 , 10526975 }, ;
{ 0.5, 10526975, 16768185 } } ) }
oBtn1:cToolTip = { "Exit compare-test","EXIT", 1, CLR_BLACK, 14089979 }
oBtn1:SetColor( 0, )
@ 500, 25 TABS oTabs1 PROMPTS "&One", "&Two", "T&hree", "&Four" OF oDlg PIXEL ;
BITMAPS "..\bitmaps\16x16\people.bmp", "..\bitmaps\16x16\open2.bmp",;
"..\bitmaps\16x16\print.bmp", "..\bitmaps\16x16\zoom2.bmp" ;
ACTION oDlg:Say( 5, 5, oTabs1:nOption )
oDlg:oBottom = oTabs1
oTabs1:bRClicked = { || nil }
ACTIVATE DIALOG oDlg CENTERED
CLOSE DATABASE
RELEASE FONT oFont, oFont1
RETURN NIL
//------------------------------------
FUNCTION SYNCBROWSES( oBrw1, oBrw2, oBrw3 )
WITH OBJECT oBrw2
:nColSel := oBrw1:nColSel
:nColOffset := oBrw1:nColOffset
:Refresh()
END
WITH OBJECT oBrw3
:nColSel := oBrw2:nColSel
:nColOffset := oBrw2:nColOffset
:Refresh()
END
RETURN NIL
Uwe