Is it possible to choose columns of array to be displayed on xBrowse?
I have array of 20 elements.
I want to display only five of them in order 7,3,4,5,6
How to create this kind of xBrowse?
I don't want to create another separate array or put to every element oBRWKKPOD :aCols[xxx]:nWidth:=0 to do it.
Can I use oBrw:AddCol() or something simmilar?
Robert
xBrowse & array
- Robert Frank
- Posts: 95
- Joined: Fri Nov 23, 2007 4:43 am
- Location: Gdynia-Poland
- Contact:
xBrowse & array
Robert Frank
Hello Robert,
oBrw:aCols[3]:lHide = .t.
ACTIVATE WINDOW oChild ON INIT (oBrw:SwapCols( oBrw:aCols[1], oBrw:aCols[2] ), oBrw:SetFocus())
This is from FWH/SAMPLES/TESTXBRW.prg
I implemented the changes.
STATIC FUNCTION ArraySort( oWnd )
local oChild, oBrw, oCol
local aStruc
DEFINE WINDOW oChild TITLE "DBF structure with auto sort and incremental seek" MDICHILD OF oWnd
oBrw := TXBrowse():New( oWnd )
aStruc := DBStruct()
Aeval( aStruc, {|v| v[1] := Padr( v[1], 10 ) } )
oBrw:SetArray( aStruc, .t. )
oBrw:aCols[1]:cHeader := "NAME"
oBrw:aCols[2]:cHeader := "TYPE"
oBrw:aCols[2]:nDataStrAlign := AL_CENTER
oBrw:aCols[2]:nHeadStrAlign := AL_CENTER
oBrw:aCols[3]:cHeader := "SIZE"
oBrw:aCols[3]:nDataStrAlign := AL_RIGHT
oBrw:aCols[3]:nHeadStrAlign := AL_RIGHT
oBrw:aCols[3]:nHeadStrAlign := AL_RIGHT
oBrw:aCols[3]:lHide = .t.
oBrw:aCols[4]:cHeader := "LENGTH"
oBrw:aCols[4]:nDataStrAlign := AL_RIGHT
oBrw:aCols[4]:nHeadStrAlign := AL_RIGHT
oBrw:lHScroll := .f.
oBrw:lVScroll := .f.
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW
oBrw:CreateFromCode()
oChild:oClient := oBrw
ACTIVATE WINDOW oChild ON INIT (oBrw:SwapCols( oBrw:aCols[1], oBrw:aCols[2] ), oBrw:SetFocus())
RETURN NIL
oBrw:aCols[3]:lHide = .t.
ACTIVATE WINDOW oChild ON INIT (oBrw:SwapCols( oBrw:aCols[1], oBrw:aCols[2] ), oBrw:SetFocus())
This is from FWH/SAMPLES/TESTXBRW.prg
I implemented the changes.
STATIC FUNCTION ArraySort( oWnd )
local oChild, oBrw, oCol
local aStruc
DEFINE WINDOW oChild TITLE "DBF structure with auto sort and incremental seek" MDICHILD OF oWnd
oBrw := TXBrowse():New( oWnd )
aStruc := DBStruct()
Aeval( aStruc, {|v| v[1] := Padr( v[1], 10 ) } )
oBrw:SetArray( aStruc, .t. )
oBrw:aCols[1]:cHeader := "NAME"
oBrw:aCols[2]:cHeader := "TYPE"
oBrw:aCols[2]:nDataStrAlign := AL_CENTER
oBrw:aCols[2]:nHeadStrAlign := AL_CENTER
oBrw:aCols[3]:cHeader := "SIZE"
oBrw:aCols[3]:nDataStrAlign := AL_RIGHT
oBrw:aCols[3]:nHeadStrAlign := AL_RIGHT
oBrw:aCols[3]:nHeadStrAlign := AL_RIGHT
oBrw:aCols[3]:lHide = .t.
oBrw:aCols[4]:cHeader := "LENGTH"
oBrw:aCols[4]:nDataStrAlign := AL_RIGHT
oBrw:aCols[4]:nHeadStrAlign := AL_RIGHT
oBrw:lHScroll := .f.
oBrw:lVScroll := .f.
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW
oBrw:CreateFromCode()
oChild:oClient := oBrw
ACTIVATE WINDOW oChild ON INIT (oBrw:SwapCols( oBrw:aCols[1], oBrw:aCols[2] ), oBrw:SetFocus())
RETURN NIL
- Robert Frank
- Posts: 95
- Joined: Fri Nov 23, 2007 4:43 am
- Location: Gdynia-Poland
- Contact:
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Here is how:
Code: Select all
oBrw := TXBrowse():New( oWnd )
oBrw:setArray( aData )
oBrw:aCols := {}
oCol := oBrw:AddCol()
oCol:bStrData := {||cValToChar( aData[oBrw:nArrayAt][7] )}
oCol := oBrw:AddCol()
oCol:bStrData := {||cValToChar( aData[oBrw:nArrayAt][3] )}
oCol := oBrw:AddCol()
oCol:bStrData := {||cValToChar( aData[oBrw:nArrayAt][4] )}
oCol := oBrw:AddCol()
oCol:bStrData := {||cValToChar( aData[oBrw:nArrayAt][5] )}
oCol := oBrw:AddCol()
oCol:bStrData := {||cValToChar( aData[oBrw:nArrayAt][6] )}
oBrw:CreateFromCode()
ownd:oClient := oBrw
ACTIVAE WINDOW oWnd
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Robert Frank
- Posts: 95
- Joined: Fri Nov 23, 2007 4:43 am
- Location: Gdynia-Poland
- Contact:
- Robert Frank
- Posts: 95
- Joined: Fri Nov 23, 2007 4:43 am
- Location: Gdynia-Poland
- Contact:
I implemented this code
oBRWKKPOD := TXBrowse():New( oDLGKKPOD )
oBRWKKPOD :SetArray( xTABAKT, .T. )
oBRWKKPOD :aCols := {}
oCol := oBRWKKPOD:AddCol()
oCol:bStrData := {||cValToChar( oBRWKKPOD:aArrayData[oBRWKKPOD:nArrayAt][2] )}
oCol:cHeader := "Kod"
oCol:nWidth := 50
oCol:blDClickData := {|| (xKOD_K:=oBRWKKPOD:aArrayData[oBRWKKPOD:nArrayAt,2],oDLGKKPOD:End()) }
oCol := oBRWKKPOD:AddCol()
oCol:bStrData := {||cValToChar( oBRWKKPOD:aArrayData[oBRWKKPOD:nArrayAt][7] )}
oCol:cHeader := "Skrót"
oCol:nWidth := 150
oCol := oBRWKKPOD:AddCol()
oCol:bStrData := {||cValToChar( oBRWKKPOD:aArrayData[oBRWKKPOD:nArrayAt][10] )}
oCol:cHeader := "Miasto"
oCol:nWidth := 100
oCol := oBRWKKPOD:AddCol()
oCol:bStrData := {||cValToChar( oBRWKKPOD:aArrayData[oBRWKKPOD:nArrayAt][11] )}
oCol:cHeader := "Adres"
oCol:nWidth := 100
oCol := oBRWKKPOD:AddCol()
oCol:bStrData := {||cValToChar( oBRWKKPOD:aArrayData[oBRWKKPOD:nArrayAt][1] )}
oCol:cHeader := "Numer"
oCol:nWidth := 50
Looks very good, but I can't autosort this array.
I've used SetArray( xTABAKT, .T. ) but when I replaced original array to created in code I losed this function of xBrowse.
How to swith it on? Any idea?
Robert
oBRWKKPOD := TXBrowse():New( oDLGKKPOD )
oBRWKKPOD :SetArray( xTABAKT, .T. )
oBRWKKPOD :aCols := {}
oCol := oBRWKKPOD:AddCol()
oCol:bStrData := {||cValToChar( oBRWKKPOD:aArrayData[oBRWKKPOD:nArrayAt][2] )}
oCol:cHeader := "Kod"
oCol:nWidth := 50
oCol:blDClickData := {|| (xKOD_K:=oBRWKKPOD:aArrayData[oBRWKKPOD:nArrayAt,2],oDLGKKPOD:End()) }
oCol := oBRWKKPOD:AddCol()
oCol:bStrData := {||cValToChar( oBRWKKPOD:aArrayData[oBRWKKPOD:nArrayAt][7] )}
oCol:cHeader := "Skrót"
oCol:nWidth := 150
oCol := oBRWKKPOD:AddCol()
oCol:bStrData := {||cValToChar( oBRWKKPOD:aArrayData[oBRWKKPOD:nArrayAt][10] )}
oCol:cHeader := "Miasto"
oCol:nWidth := 100
oCol := oBRWKKPOD:AddCol()
oCol:bStrData := {||cValToChar( oBRWKKPOD:aArrayData[oBRWKKPOD:nArrayAt][11] )}
oCol:cHeader := "Adres"
oCol:nWidth := 100
oCol := oBRWKKPOD:AddCol()
oCol:bStrData := {||cValToChar( oBRWKKPOD:aArrayData[oBRWKKPOD:nArrayAt][1] )}
oCol:cHeader := "Numer"
oCol:nWidth := 50
Looks very good, but I can't autosort this array.
I've used SetArray( xTABAKT, .T. ) but when I replaced original array to created in code I losed this function of xBrowse.
How to swith it on? Any idea?
Robert
Robert Frank
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
You can manually define bLClickHeader blocks. Alternatively, let all the columns be defined initially by SetArray method, including autosort.
Then hide the columns you dont want. ( eg. oBrw:aCols[n]:Hide() ).
You can also swap cols for repositioning them ( eg oBrw:SwapCols( 2,7 ) )
You can then get what you want
Then hide the columns you dont want. ( eg. oBrw:aCols[n]:Hide() ).
You can also swap cols for repositioning them ( eg oBrw:SwapCols( 2,7 ) )
You can then get what you want
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Robert Frank
- Posts: 95
- Joined: Fri Nov 23, 2007 4:43 am
- Location: Gdynia-Poland
- Contact: