Eso
grcias.
goosfancito wrote:dale, no hay drama.
Mañana cuelgo uno el github asi pueden acceder
METHOD Sort( lAsc, lRecurs ) CLASS TLinkList
local oPrev, oNext, n, aItems := {}
local oItem
local bSort
DEFAULT lAsc := .t., lRecurs := .f.
if HB_ISBLOCK( lAsc )
bSort := lAsc
lAsc := .t.
else
if HB_ISSTRING( lAsc )
lAsc := ( UPPER( LEFT( lAsc, 1 ) ) == "A" )
else
lAsc := !Empty( lAsc )
endif
if lAsc
bSort := { |x,y| Upper( x:cPrompt ) < Upper( y:cPrompt ) }
else
bSort := { |x,y| Upper( x:cPrompt ) > Upper( y:cPrompt ) }
endif
endif
if ::oFirst == nil
return nil
endif
oPrev := ::oFirst:oPrev
oNext := ::oLast:oNext
::Eval( { |o| AAdd( aItems, o ) }, nil, nil, .f. )
if lRecurs
AEval( aItems, { |o| If( o:oTree == nil,, o:oTree:Sort( bSort, .t. ) ) } )
endif
ASort( aItems,,,bSort )
::oFirst := aItems[ 1 ]
::oFirst:oPrev := oPrev
for n := 2 to Len( aItems )
aItems[ n ]:oPrev := aItems[ n - 1 ]
aItems[ n - 1 ]:SetNext( aItems[ n ] )
next n
::oLast := ATail( aItems )
::oLast:SetNext( oNext )
return nil
#include "fivewin.ch"
function Main()
local oTree
oTree := MakeTree()
XBROWSER oTree AUTOSORT SETUP ( ;
oBrw:aCols[ 1 ]:cSortOrder := { |oCol| SetOrder( oCol ) } ;
)
return nil
static function SetOrder( oCol )
local cOrder := If( oCol:cOrder == "A", "D", "A" )
WITH OBJECT oCol:oBrw
:oTree:Sort( cOrder, .t. )
:GoTop()
END
return cOrder
static function MakeTree()
local oTree
TREE oTree
TREEITEM "DEF"
TREE
TREEITEM "222"
TREEITEM "333"
TREE
TREEITEM "JAN"
TREEITEM "FEB"
TREEITEM "MAR"
ENDTREE
TREEITEM "111"
ENDTREE
TREEITEM "ABC"
TREE
TREEITEM "777"
TREEITEM "333"
TREEITEM "444"
ENDTREE
TREEITEM "CDE"
TREE
TREEITEM "SUN"
TREEITEM "MON"
TREEITEM "TUE"
ENDTREE
ENDTREE
oTree:OpenAll()
return oTree
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: No registered users and 30 guests