Page 1 of 1

treeview

Posted: Tue Aug 14, 2007 4:05 pm
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

Posted: Tue Aug 14, 2007 5:32 pm
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 )

Posted: Tue Aug 14, 2007 5:39 pm
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 );
}