treeview

Post Reply
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

treeview

Post by Otto »

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
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

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: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Then, given a TV_ITEM handle, you can retrieve its lParam value:

Code: Select all

HB_FUNC( TVIPARAM ) // hItem --> nLParam
{
   hb_retnl( ( ( TV_ITEM * ) hb_parnl( 1 ) )->lParam );
}
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply