Hi Huys,
I need to change completely the content of a xBrowse at run time. The oRowSet, the ttitles and the formats of the columns. Is it possible ?
Public aVelden1:= { ;
{ "klant_nr" , "Code" , NIL, 65 }, ; // 1
{ "naam_1" , "Naam" , NIL, 240 }, ; //
{ "gemeente" , "Gemeente" , NIL, 110 }, ; // 1
{ "dat_lst" , "DatLST" , NIL, 70 }, ; // 1
{ "Jaar_1" , "J1" , NIL, 75 }, ; // 1
{ "Jaar_2" , "J1" , NIL, 75 }, ; // 1
{ "Jaar_3" , "J1" , NIL, 75 }, ; // 1
{ "Jaar_4" , "J1" , NIL, 75 }, ; // 1
{ "Jaar_5" , "J1" , NIL, 75 }, ; // 1
{ "totomzet" , "omzet" , NIL, 70 }} // 1
@ 55,0 XBROWSE oBrw[1] size -1,-1 PIXEL OF oFld:aDialogs[ 1 ] font oFonts ;
DATASOURCE "klant" ;
COLUMNS aVelden1;
AUTOSORT CELL LINES NOBORDER FOOTERS
oBrw[1]:cHeaders := { 'Code','Naam','Gemeente','Dat_LST',str(year(date()),4),str(year(date())-1,4),str(year(date())-2,4),str(year(date())-3,4),str(year(date())-4,4),'Totaal' }
oBrw[1]:SetChecks()
oBrw[1]:bRClicked := { || XbrShowSizes( oBrw[1] ) }
//oBrw[1]:nStretchCol := STRETCHCOL_WIDEST
oBrw[1]:CreateFromCode()
WITH OBJECT :oCol( "J_" + Str( Year( Date() ), 4 ) )
oRsNew:ResetXBr( oBrw ) // oBrw is the running xbrowse
oRsNew:SetXbrColumns( oBrw, [aCols] ) // If aCols is ommitted, all columns
oBrw:Refresh()
#include "fivewin.ch"
function Main()
local oCn, oStates, oCust
local aStateCols, aCustCols
local oDlg, oBrw
oCn := FW_DemoDB()
oStates := oCn:RowSet( "states" )
oCust := oCn:RowSet( "customer" )
aStateCols := { "Code", "Name" }
aCustCols := { { "First", "CustName" }, ;
{ "Age", "CustAge" }, ;
{ "Salary", "Due", "99,999,999.99" } }
DEFINE DIALOG oDlg SIZE 400,500 PIXEL TRUEPIXEL
@ 70,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE oStates COLUMNS aStateCols ;
CELL LINES NOBORDER FASTEDIT FOOTERS
oBrw:CreateFromCode()
@ 10, 20 BTNBMP PROMPT "Customer" SIZE 100,40 PIXEL OF oDlg FLAT ACTION ;
( oCust:ResetXbr( oBrw ), oCust:SetXbrColumns( oBrw, aCustCols ), ;
oBrw:lFooter := .t., ;
oBrw:Due:nFooterType := AGGR_SUM, ;
oBrw:MakeTotals(), ;
oBrw:Refresh() )
@ 10,120 BTNBMP PROMPT "States" SIZE 100,40 PIXEL OF oDlg FLAT ACTION ;
( oStates:ResetXbr( oBrw ), oStates:SetXbrColumns( oBrw, aStateCols ), ;
oBrw:lFooter := .f., ;
oBrw:Refresh() )
@ 10,220 BTNBMP PROMPT "EDIT" SIZE 100,40 PIXEL OF oDlg FLAT ACTION oBrw:EditSource()
ACTIVATE DIALOG oDlg CENTERED
oStates:Close()
oCust:Close()
oCn:Close()
return nil
oRs:oCn := oNewCon // optional
oRs:ReQuery( "select * from different_table" )
oRs:SetXbrColumns( oBrw, [aCols] )
oBrw:Refresh()
#include "fivewin.ch"
function Main()
local oCn, oRs
local aStateCols, aCustCols
local oDlg, oBrw
oCn := FW_DemoDB()
oRs := oCn:RowSet( "states" )
aStateCols := { "Code", "Name" }
aCustCols := { { "First", "CustName" }, ;
{ "Age", "CustAge" }, ;
{ "Salary", "Due", "99,999,999.99" } }
DEFINE DIALOG oDlg SIZE 400,500 PIXEL TRUEPIXEL
@ 70,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE oRs COLUMNS aStateCols ;
CELL LINES NOBORDER FASTEDIT FOOTERS
oBrw:CreateFromCode()
@ 10, 20 BTNBMP PROMPT "Customer" SIZE 100,40 PIXEL OF oDlg FLAT ACTION ;
( oRs:Requery( "select * from customer" ), ;
oRs:SetXbrColumns( oBrw, aCustCols ), ;
oBrw:lFooter := .t., ;
oBrw:Due:nFooterType := AGGR_SUM, ;
oBrw:MakeTotals(), ;
oBrw:Refresh() )
@ 10,120 BTNBMP PROMPT "States" SIZE 100,40 PIXEL OF oDlg FLAT ACTION ;
( oRs:Requery( "select * from states" ), ;
oRs:SetXbrColumns( oBrw, aStateCols ), ;
oBrw:lFooter := .f., ;
oBrw:Refresh() )
@ 10,220 BTNBMP PROMPT "EDIT" SIZE 100,40 PIXEL OF oDlg FLAT ACTION oBrw:EditSource()
ACTIVATE DIALOG oDlg CENTERED
oRs:Close()
oCn:Close()
return nil
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 89 guests