ADD COLUMN TO ::oBrwOrder ARRAY ELM 1 ;
HEADER " No." LEFT ;
SIZE oBFont1:nWidth * 7 ;
PICT "@!K" ;
::oBrwOrder:AddColumn( TCColumn():New( If(.F., OemToAnsi(" No."), " No."), {|x| If(Pcount()>0, ::oBrwOrder:aArray[::oBrwOrder:nAt, 1] :=x, ::oBrwOrder:aArray[::oBrwOrder:nAt, 1])}, "@!K",,, Upper("LEFT"), oBFont1:nWidth * 7, .F., .F.,,,, .F. ) )
//----------------------------------------------------------------------------//
function Child()
local oWndChild, oBrw, oFont
local nI, aTestData
local aObjects[10]
DEFINE WINDOW oWndChild MDICHILD OF oWnd ;
FROM 10, 50 TO 250, 400 PIXEL COLOR "N/W"
aBrwArray:={}
aadd(aBrwArray,{"01","First"})
aadd(aBrwArray,{"02","Second"})
@ 1.5,5 COLUMN BROWSE aObjects[6] OF oWndChild SIZE 150, 135
aObjects[6]:SetArray(aBrwArray)
aObjects[6]:AddColumn(TCColumn():New("Num",{|x| ;
If(Pcount()>0, aObjects[6]:aArray[aObjects[6]:nAt, 1] :=x, aObjects[6]:aArray[aObjects[6]:nAt, 1])},,,,,100))
aObjects[6]:AddColumn(TCColumn():New("Title",{|x| ;
If(Pcount()>0, aObjects[6]:aArray[aObjects[6]:nAt, 2] :=x, aObjects[6]:aArray[aObjects[6]:nAt, 2])},,,,,100))
oWndChild:SetControl( aObjects[6] )
ACTIVATE WINDOW oWndChild
return nil
Marco Turco wrote:The only problem is that I try to assign the columns through a for cicle I receive an array access error message.
function Child()
local oWndChild, nI, bData, aObjects[ 10], ;
aTitles := { "Num", "Title" }
DEFINE WINDOW oWndChild MDICHILD OF oWnd ;
FROM 10, 50 TO 250, 400 PIXEL COLOR "N/W"
aBrwArray:={}
aadd(aBrwArray,{"01","First"})
aadd(aBrwArray,{"02","Second"})
@ 1.5,5 COLUMN BROWSE aObjects[6] OF oWndChild SIZE 150, 135
aObjects[6]:SetArray(aBrwArray)
For nI := 1 To Len( aTitles )
bData := BuildBlock( AObjects[ 6 ], nI )
aObjects[6]:AddColumn(TCColumn():New( aTitles[ nI ], bData,,,,, 100 ) )
next
oWndChild:SetControl( aObjects[6] )
ACTIVATE WINDOW oWndChild
return nil
//----------------------------------------------------------------------------//
Static Function BuildBlock( oBrw, n )
Return { |x| If( Pcount() > 0, oBrw:aArray[ oBrw:nAt, n ] := x, oBrw:aArray[ oBrw:nAt, n ] ) }
Marco Turco wrote:Could you suggest me what is the correct codeblock code to make also
a column with the progressive number ?
Like the command:
ADD TO oBrw DATA oBrw:nAt()
Marco Turco wrote:** column with progressive number **
Objects[6]:AddColumn(TCColumn():New( "", {||aObjects[6]:nAt},,,,, 25 ) )
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Antonio Linares, Google [Bot], MarcoBoschi and 39 guests