FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Treeview question
Posts: 28
Joined: Tue Nov 15, 2005 01:03 AM
Treeview question
Posted: Wed Nov 30, 2005 08:47 PM

Hi guys

I'm working in a Treeview control and don't find the way to show the dots lines and (+) (-) sign. There is no problem with the items brance neither bitmaps only the dots.

Any suggest?

Thanks

Williams

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Treeview question
Posted: Thu Dec 01, 2005 09:52 AM

Williams,

You may review samples\TreeView.prg and samples\TestTree.prg. In both samples a treeview is used and the [+], [-] and dotted lines are shown.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 28
Joined: Tue Nov 15, 2005 01:03 AM
Treeview question
Posted: Thu Dec 01, 2005 08:21 PM
Thanks Antonio

You're right but the samples show a control from code not from resource. I don't know if this could be the problem. I've set up a SysTreeView32 control on this way from RWS

CONTROL "", 1007, "SysTreeView32", WS_CHILD | WS_VISIBLE | WS_BORDER, 12, 72, 206, 100

and my code is

define dialog oDlg of oWChild resource "nomdepto" font oCfg:aFonts[1]

oImageList := TImageList():New( 0, 0 )
oTree := TTreeView():Redefine( 1007, oDlg )
oTree:bChanged = { || ChkTreeItem( oTree:GetSelected(), oNomDep ), ;
		                      ChgCtrlMode( oGet, "REFRESH" ) }

activate window oWChild valid on init FillTree( oTree, oImageList, oNomDep )
// --------------------------------------------------------
function FillTree( oTree, oImageList, oNomDep )
	local cCodigo, lFirst := .t.
	local cOrder := oNomDep:SetOrder( "codigo" )

	oTree:SetImageList( oImageList )
	do while !oNomDep:Eof()
		if lFirst
			cCodigo := AllTrim( oNomDep:nomdepcod )
			lFirst := .f.
		endif

		if Len( AllTrim( oNomDep:nomdepcod )) == Len( cCodigo )
			oTree:Add( AllTrim( oNomDep:nomdepcod ) + " - " + AllTrim( oNomDep:nomdepnom ), 0 )
		endif
		oNomDep:Skip()
	enddo
	oNomDep:SetOrder( cOrder )
	
return nil
// --------------------------------------------------------
function ChkTreeItem( oItem, oNomDep, oGet )
	local cCodigo := AllTrim( StrToken( oItem:cPrompt, 1, "-" ))
	local cOrder := oNomDep:SetOrder( "codigo" )
	local nPos

	oNomDep:Seek( cCodigo )
	nPos := oNomDep:RecNo()
	if Len( oItem:aItems ) = 0
		oNomDep:Skip()
		cRoot := AllTrim( oNomDep:nomdepcod )
		if !oNomDep:Eof()
			do while !oNomDep:Eof()
				if Left( oNomDep:nomdepcod, Len( cCodigo )) == cCodigo .and. ;
				   Len( AllTrim( oNomDep:nomdepcod )) = Len( cRoot )
					oItem:Add( AllTrim( oNomDep:nomdepcod ) + " - " + AllTrim( oNomDep:nomdepnom ))
				endif
				oNomDep:Skip()
			enddo
		endif
	endif
	oNomDep:GoTo( nPos )
	oNomDep:Load()
	oItem:Expand()
return nil



so as I say before, the grid work ok, every brance works fine. If I define bitmaps on the oImageList object this shows ok... the only thing is the lines dots. Take in mind that the database object was defined ok and working... just I don't put code about it for compact the sample

Thanks
Posts: 28
Joined: Tue Nov 15, 2005 01:03 AM
Treeview question
Posted: Fri Dec 02, 2005 04:07 PM
Dear friends:

After look several samples, finally I found the solution to the (+)/(-) bitmaps and dotlines. When you defined an SysTreeView32 control on a DLL or .RC file, you should set the constant number 135 or 7 in the control style box
CONTROL "", 1007, "SysTreeView32", WS_CHILD | WS_VISIBLE | 135 | WS_BORDER, 12, 72, 206, 100

The another tip is fill the tree in the ON INIT event of your dialog activation. After that you Tree control should look fine :-)
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Treeview question
Posted: Fri Dec 02, 2005 08:07 PM

Williams,

Many thanks for your feedback,

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 42
Joined: Fri Oct 21, 2005 02:12 PM
Treeview question
Posted: Fri Dec 02, 2005 08:10 PM
Hi Again Williams

Since now accomplished to decomapile the dll. I post here the results for you or enyone who want this info.

Try the following:
CONTROL "", 4008, "SysTreeView32", TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 402, 195, 225, 150 , 0x00020200


Regards from Greece :-)
Dionisis

Continue the discussion