// Browsing arrays using TWBrowse
#include "FiveWin.ch"
//----------------------------------------------------------------------------//
function Main()
local oDlg, oBrw
local aSample := { { "First row one", "First row two" },;
{ "Second row one", "Second row two" },;
{ "Third row one", "Third row two" },;
{ "Fourth row one", "Fourth row two" } }
SET _3DLOOK ON
DEFINE DIALOG oDlg FROM 2, 2 TO 20, 60 TITLE "right click on the listbox"
@ 1, 2 LISTBOX oBrw ;
FIELDS "", "" ;
HEADERS "Reviewing two dimensions", "Array" ;
FIELDSIZES 150, 150 ;
OF oDlg ;
SIZE 150, 100 ;
ON DBLCLICK MsgInfo( "Array row: " + Str( oBrw:nAt ) + CRLF + ;
"Array col: " + Str( oBrw:nAtCol( nCol ) ) )
// bLine is a codeblock that returns an array
// if you need a 'traditional column based browse' have a look at TcBrowse
oBrw:nAt = 1
oBrw:bLine = { || { aSample[ oBrw:nAt ][ 1 ], aSample[ oBrw:nAt ][ 2 ] } }
oBrw:bGoTop = { || oBrw:nAt := 1 }
oBrw:bGoBottom = { || oBrw:nAt := Eval( oBrw:bLogicLen ) }
oBrw:bSkip = { | nWant, nOld | nOld := oBrw:nAt, oBrw:nAt += nWant,;
oBrw:nAt := Max( 1, Min( oBrw:nAt, Eval( oBrw:bLogicLen ) ) ),;
oBrw:nAt - nOld }
oBrw:bLogicLen = { || Len( aSample ) }
oBrw:cAlias = "Array" // Just put something
oBrw:brclicked := { |row,col| TROCA_FONT( oBrw ) }
@ 1, 30 BUTTON "&End" OF oDlg ACTION oDlg:End()
ACTIVATE DIALOG oDlg CENTERED
return nil
*******************
function TROCA_FONT( oBrw )
*******************
local oObj
oBrw:GetFont()
oBrw:SelFont()
oBrw:setcolor( oBrw:nClrText, choosecolor(oBrw:nClrPane) )
oBrw:refresh()
return NIL
METHOD SelFont() BLOCK { | Self, nClr | nClr := ::nClrText,;
::SetFont( If( ::oFont == nil,;
TFont():New( ,,,.t. ),;
::oFont:Choose( @nClr ) ) ),;
::oFont:nCount--,;
::nClrText := nClr, ::Refresh() }
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 103 guests