@ 518, 935 RADIO oFilename VAR nFilename PROMPT "Samples1", "Samples2", "Samples3", "Samples4", ;
"Samples5", "Samples6", "Samples7" _3D SIZE 80, 25 ;
HELPID 100, 101, 102, 103, 104, 105, 106 OF oDlg PIXEL UPDATE ;
ON CHANGE ( SAVE_SYS(nOFilename), ; // saves old values before reading the new ones.
nOFilename := nFilename, ;
READ_SYS(.T.), ; // reading the NEW values
DBSELECTAREA(cFileName), ;
oBrw:SetGroupHeader( "Workarea ==> " + DBF() + " Index ==> " + (cFileName)->(INDEXKEY(nOrder)) + ;
" Order ==> " + ALLTRIM( STR( (cFileName)->(INDEXORD()) ) ) ), ;
XBRW_COLOR( oBrw ), oDlg:UPDATE(), ;
oBrw:aCols[nOrder]:bClrStd := {|| { 0, aVal[32] } } )
INDEX-change !!!
AEval( oBrw:aCols, { |o| o:bLClickHeader := {|r,c,f,o| XBRW_COLOR( oBrw ), ; // painting ROW-colors
nOrder := o:nCreationOrder, ;
(cFileName)->(DBSETORDER(nOrder)), ;
o:bClrStd := {|| { 0, aVal[32] } }, ; // COLUMN-color for INDEX
oBrw:SetGroupHeader( "Workarea ==> " + DBF() + " Index ==> " + ; // header-title refreshed
(cFileName)->(INDEXKEY(nOrder)) + " Order ==> " + ;
ALLTRIM( STR( (cFileName)->(INDEXORD()) ) ) ) } } )
// -----------------
FUNCTION XBRW_COLOR( oBrw )
// to clear / reset the column-colors
//I := 1
//FOR I := 1 TO 8
// oBrw :aCols[I]:bClrStd := {|| { NIL, NIL } }
//NEXT
// ROW - colors
oBrw :bClrRowFocus := { || { aVal[31], aVal[29] } } // light red
oBrw :bClrStd := { || If( oBrw:KeyNo() % 2 == 0, ;
{ If( ( oBrw:cAlias )->( Deleted() ), 255, aVal[31] ), aVal[27] }, ; // light blue
{ If( ( oBrw:cAlias )->( Deleted() ), 255, aVal[31] ), aVal[28] } ) } // light blue
oBrw :bClrSel := ;
oBrw :bClrSelFocus := { || { If( ( oBrw:cAlias )->( Deleted() ), 255, aVal[31] ), aVal[30] } } // light green
oBrw :nClrText := aVal[31]
oBrw:Refresh()
RETURN NIL
@ 518, 935 RADIO oFilename VAR nFilename PROMPT "Samples1", "Samples2", "Samples3", "Samples4", ;
"Samples5", "Samples6", "Samples7" _3D SIZE 80, 25 ;
HELPID 100, 101, 102, 103, 104, 105, 106 OF oDlg PIXEL UPDATE ;
ON CHANGE ChangeDBF( oBrw, nFileName )
function ChangeDBF( oBrw, nFileName )
local cAlias := "Samples" + Str( nFileName, 1, 0 )
local cTag := ( cAlias )->( OrdName() )
oBrw:cAlias := cAlias
oBrw:aCols[ 1 ]:cGrpHdr := "WorkArea ==> " + oBrw:cAlias + ;
" Index ==> " + ( oBrw:cAlias )->( OrdKey() ) + ;
" Order ==> " + ( oBrw:cAlias )->( OrdNumber() )
AEval( oBrw:aCols, { |o| o:cOrder := If( o:cSortOrder == cTag, "A", "" ) } )
oBrw:Refresh()
return nil
// When creating the browse;
AEval( oBrw:aCols, { |o| o:bClrStd := FnClrStdBlock( o ) } )
//
function FnClrStdBlock( oCol )
return { || If( Empty( oCol:cOrder ), If( oCol:oBrw:KeyNo() % 2 == 0, { nClr1, nClr2 }, { nClr3, nClr4 } ), { nIdxClr1, nIdxClr2 } ) }
#include "fivewin.ch"
#include "xbrowse.ch"
function TestMain()
local oWnd
local oBrw
local oBar
local lEmpty := .f.
local aArray := {}
DEFINE WINDOW oWnd TITLE "Testing Autosave Data"
if empty( aArray )
aArray := {{"one","two","three","four"},;
{"one","two","three","four"},;
{"one","two","three","four"},;
{"one","two","three","four"}}
endif
@ 0,0 XBROWSE oBrw OF oWnd ;
COLUMNS {1,2,3,4} ;
HEADERS {"Activated-1","Activated-2","Deactivated-1","DeActivated-2"} ;
array aArray LINES CELL fastedit
oBrw:aCols[ 1 ]:lAutoSave := .t.
oBrw:aCols[ 2 ]:lAutoSave := .t.
aeval( oBrw:aCols, { |oCols| oCols:nEditType := EDIT_GET } )
// changing column-color !!!
AEval( oBrw:aCols, { |o| o:bClrStd := FNCLRSTDBLOCK( o ) } )
oWnd:oClient := oBrw
oBrw:createfromcode()
activate window oWnd
return nil
// ---------
FUNCTION FNCLRSTDBLOCK( oCol )
RETURN { || If( Empty( oCol:cOrder ), If( oCol:oBrw:KeyNo() % 2 == 0, ;
{ 0, 15263976 }, { 0, 16772055 } ), { 0, 255 } ) }
Please add the clause AUTOSORT to the XBROWSE command.
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 90 guests