Hi Mr. Rao / All
Is this possible with xBrowse?
function colsasrows()
local oWnd, oBrw, oFont
USE CUSTOMER
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE WINDOW oWnd
oWnd:SetFont( oFont )
@ 0,0 XBROWSE oBrw OF oWnd DATASOURCE "CUSTOMER" ;
COLUMNS "FIRST","LAST","STREET","CITY","ZIP","HIREDATE","AGE","SALARY" ;
HEADERS "CustName", nil, "Address", nil, nil, "Details" ;
CELL LINES NOBORDER
WITH OBJECT oBrw
:aCols[ 1 ]:SetColsAsRows( 1, 2 )
:aCols[ 3 ]:SetColsAsRows( 3, 4, 5 )
:aCols[ 6 ]:SetColsAsRows( 6, 7, 8 )
//
:CreateFromCode()
END
oWnd:oClient := oBrw
ACTIVATE WINDOW oWnd CENTERED
RELEASE FONT oFont
return nil
function colsasrows()
local oWnd, oBrw, oFont, aCols
local nLine := 0
USE CUSTOMER ALIAS CUST
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE WINDOW oWnd
oWnd:SetFont( oFont )
aCols := { ;
{ { || If( nLine == 0, STR(CUST->ID,4), "" ) }, "ID" }, ;
{ { || If( nLine == 0, CUST->FIRST, If( nLine == 1, CUST->LAST, "" ) ) }, "CustName" }, ;
{ { || If( nLine == 0, CUST->STREET, If( nLine == 1, CUST->CITY, CUST->ZIP ) ) }, "Address" }, ;
{ { || If( nLine == 0, DTOC(CUST->HIREDATE), If( nLine == 1, Str( CUST->AGE, 2 ), TRANSFORM( CUST->SALARY,"9,999,999.99") ) ) }, "Details" } }
@ 0,0 XBROWSE oBrw OF oWnd DATASOURCE "CUST" ;
COLUMNS aCols ;
CELL LINES NOBORDER
// Navigation blocks
oBrw:bGoTop := { || nLine := 0, ( oBrw:cAlias )->( DBGOTOP() ) }
oBrw:bGoBottom := { || nLine := 2, ( oBrw:cAlias )->( DBGOBOTTOM() ) }
oBrw:bKeyCount := { || ( oBrw:cAlias )->( OrdKeyCount() ) * 3 }
oBrw:bKeyNo := { || ( ( oBrw:cAlias )->( OrdKeyNo() - 1 ) * 3 ) + 1 + nLine }
oBrw:bSkip := { |nSkip| ( oBrw:cAlias )->( MySkipper( nSkip, @nLine ) ) }
oBrw:bKeyNo := { |n| If( n != nil, ( n--, ( oBrw:cAlias )->( OrdKeyGoTo( Int( n / 3 ) + 1 ) ), nLine := n % 3 ), nil ), ;
( ( oBrw:cAlias )->( OrdKeyNo() - 1 ) * 3 ) + 1 + nLine }
oBrw:bBookMark := { |n| If( n != nil, ( n--, ( oBrw:cAlias )->( DbGoTo( Int( n / 3 ) + 1 ) ), nLine := n % 3 ), nil ), ;
( ( oBrw:cAlias )->( RecNo() - 1 ) * 3 ) + 1 + nLine }
WITH OBJECT oBrw
:aCols[ 1 ]:nDataStrAlign := AL_RIGHT
:aCols[ 4 ]:nDataStrAlign := AL_RIGHT
:aCols[ 4 ]:bLeftText := { || If( nLine == 0, "Date:", If( nLine == 1, "Age:", "Sal:" ) ) }
:aCols[ 4 ]:nWidth := 140
:bClrStd := { || { CLR_BLACK, If( nLine == 0, CLR_HGRAY, CLR_WHITE ) } }
//
:CreateFromCode()
END
oWnd:oClient := oBrw
ACTIVATE WINDOW oWnd CENTERED
RELEASE FONT oFont
return nil
static function MySkipper( nSkip, nLine )
local nSkipped := 0
DEFAULT nSkip := 1
if nSkip == 0
return 0
endif
if nSkip > 0
do while nSkipped < nSkip
if nLine < 2
nLine++
nSkipped++
else
DBSKIP( 1 )
if Eof()
DBGOBOTTOM()
EXIT
endif
nLine := 0
nSkipped++
endif
enddo
else
do while nSkipped > nSkip
if nLine > 0
nLine--
nSkipped--
else
DBSKIP( -1 )
if BOF()
EXIT
endif
nLine := 2
nSkipped--
endif
enddo
endif
return nSkipped
nageswaragunupudi wrote:yes
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 45 guests