Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TREEVIEW: How to make node show multi-line text?

368 views
Skip to first unread message

Josh Prowse at IOPENER.CA

unread,
Mar 3, 2002, 5:22:03 AM3/3/02
to
Hi WinApis--

I'm using the treeview control in VB6 and I want to be able to display
multiple lines of text for each node. Right now you just get scroll boxes,
but some of my entries are very long, and I'd like to be able to wrap text
in each node like a multi-line text box. I read some stuff in MSDN about
TVITEMEX messages to set the item height, but it said that the treeview
control couldn't write to the expanded area, and it discussed some "Custom
Draw" calls, and right about then my eyes clouded over and I woke up with my
head in a puddle of drool on my keyboard.

Any ideas?

TIA,

:-j

=====================
Josh Prowse, IOPENER Consulting
joshprowse...@iopener.andthis.ca
http://iopener.ca
=====================
(Spam filter in effect... you figure it out)


Timo Kunze

unread,
Mar 3, 2002, 6:50:52 AM3/3/02
to
You've read right! You need to send a TVM_SETITEM-message to the treeview.
LParam needs to be a TVITEMEX-structure. In this structure, iIntegral has to
be set to number, which is multiplied with the item-height (the common one,
which is the same for all items) in order to get the item-height for this
single item. Mask has to be set to TVIF_INTEGRAL and hItem is the handle to
the item.
Then you'll have to subclass the control and process
WM_NOTIFY/NM_CUSTOMDRAW...

This is difficult to be done with the native VB-treeview. And since the
6.0-treeview isn't based on the windows commoncontrols, I'm afraid this
won't work at all.

Good luck!


Josh Prowse at IOPENER.CA

unread,
Mar 3, 2002, 7:57:14 AM3/3/02
to
Timo--

OK, that made me laugh. I especially liked the "this won't work at all"
followed immediately by "Good luck!"

Thanks for the quick response anyhow. Now it's time to convince the users
that multiline nodes aren't necessary...

:-j

=====================
Josh Prowse, IOPENER Consulting
joshprowse...@iopener.andthis.ca
http://iopener.ca
=====================
(Spam filter in effect... you figure it out)

"Timo Kunze" <TKunz...@gmx.de> wrote in message
news:eHIAmmqwBHA.2088@tkmsftngp07...

Randy Birch

unread,
Mar 3, 2002, 8:49:54 PM3/3/02
to
> 6.0-treeview isn't based on the windows commoncontrols, I'm afraid this
> won't work at all.

That's not entirely correct.

The VB6 controls do not *rely* on comclt32.dll for their functionality ...
but are indeed based on it. The VB team essentially rewrote comctl32.dll
inside the VB6 mscomctl.ocx file, and that ocx responds to most API methods
that can be fired against or applied to a VB5 control.

I suggest that Josh take a look at www.mvps.org/btmtz/ - I'm sure Brad has
tooltip code, and if not already against the VB6 control, may also work with
it.

--

Randy Birch
MVP Visual Basic

http://www.mvps.org/vbnet/

Please respond only to the newsgroups so all can benefit.

*** If you call the Sleep API in Bill's latest, will it have .NET dreams?
***


"Timo Kunze" <TKunz...@gmx.de> wrote in message
news:eHIAmmqwBHA.2088@tkmsftngp07...

Timo Kunze

unread,
Mar 4, 2002, 7:14:27 AM3/4/02
to
Well, maybe it accepts almost the same apis, but does it also use the same
structures (TVITEMEX)? If it does, things will become easier. But there's
still CustomDraw to code. It's the decision of Josh whether this expenditure
is justified.


0 new messages