Treeview question

Treeview question

Postby wpacheco » Wed Nov 30, 2005 8: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
User avatar
wpacheco
 
Posts: 28
Joined: Tue Nov 15, 2005 1:03 am
Location: Isla Margarita, Venezuela

Postby Antonio Linares » Thu Dec 01, 2005 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42071
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby wpacheco » Thu Dec 01, 2005 8: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

Code: Select all  Expand view
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
User avatar
wpacheco
 
Posts: 28
Joined: Tue Nov 15, 2005 1:03 am
Location: Isla Margarita, Venezuela

Postby wpacheco » Fri Dec 02, 2005 4: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
Code: Select all  Expand view
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 :wink:
User avatar
wpacheco
 
Posts: 28
Joined: Tue Nov 15, 2005 1:03 am
Location: Isla Margarita, Venezuela

Postby Antonio Linares » Fri Dec 02, 2005 8:07 pm

Williams,

Many thanks for your feedback,
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42071
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Sakis » Fri Dec 02, 2005 8: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:
Code: Select all  Expand view
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 :D
Dionisis
User avatar
Sakis
 
Posts: 42
Joined: Fri Oct 21, 2005 2:12 pm
Location: Athens


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 44 guests