treeview

treeview

Postby Otto » Tue Aug 14, 2007 4:05 pm

To bind treeview to a database I pass the record-ID with the text.

TestNode ID 345
TestNode Child ID 500
TestNode 2 ID 8555
TestNode Child ID 102333
TestNode Child ID 394949

Do you think there is a way to make the last characters of the nodetext invisible?
Thanks in advance
Otto
User avatar
Otto
 
Posts: 6327
Joined: Fri Oct 07, 2005 7:07 pm

Postby Antonio Linares » Tue Aug 14, 2007 5:32 pm

Otto,

When an item is inserted into a treeview a TV_INSERTSTRUCT struct is used (please review source\winapi\treeview.c).

The TV_INSERTSTRUCT contains a TV_ITEM structure and there you have a member, named lParam where you can store a 32 bits number. Similar like Clipper "cargo".

So you have to modify source\winapi\treeview.c and add this line:

is.item.lParam = _parnl( 5 );

Then modify the Class TTreeView to accept an extra parameter:

METHOD Add( cPrompt, nImage, nValue ) CLASS TTreeView
...
oItem := TTVItem():New( TVInsertItem( ::hWnd, cPrompt,, nImage, nValue ), Self )
regards, saludos

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

Postby Antonio Linares » Tue Aug 14, 2007 5:39 pm

Then, given a TV_ITEM handle, you can retrieve its lParam value:
Code: Select all  Expand view
HB_FUNC( TVIPARAM ) // hItem --> nLParam
{
   hb_retnl( ( ( TV_ITEM * ) hb_parnl( 1 ) )->lParam );
}
regards, saludos

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], Rick Lipkin and 43 guests