News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Custom drawn treeview not receiving TVN_GETINFOTIP

Started by fearless, November 22, 2023, 02:04:52 PM

Previous topic - Next topic

fearless

Encountered a strange issue that I thought was worth posting about in case some one else runs into a similar problem.

Recently I was handling custom draw (NM_CUSTOMDRAW from WM_NOTIFY) with a treeview control. The treeview control had the TVS_INFOTIP style and was receiving the TVN_GETINFOTIP event (via WM_NOTIFY as well).

I changed a few things one night, tidying up some code etc and then left it and came back the next day to realize the tooltips for each item in the treeview were no longer showing.

Spent a good bit of time trying to figure out what was the issue: tooltip text too long?, some issue in the stringtable? wrong or duplicate id in stringtable? missing start or end quotes? maybe some style i changed in the treeview. I was simply not receiving the TVN_GETINFOTIP notification at all.

Turns out that as i was handling the custom draw, including the text parts myself, I figured I wouldn't need to supply any text when adding a tree item, just the lParam which I was using as a sort of index when getting the TVN_SELCHANGED message (via WM_NOTIFY).

Without the text, the item will get added. Beforehand I was using TVIF_TEXT or TVIF_PARAM for the mask, but I changed it to just the TVIF_PARAM flag. Later on I added the TVIF_TEXT flag back in, but was supplying NULL for the text, which again meant I was not getting the tooltips (no TVN_GETINFOTIP notification).

After some experimenting, I tried adding a szSpace var to use as the text with one space ( szSpace DB " ",0 ) and I still wasn't getting the notification. It was only later on by chance I was moving the mouse over the treeview right near the left edge of the control that I was suddenly getting a tooltip notification via TVN_GETINFOTIP (using PrintText with the vKim debug macros). It was only a small part that triggered it and yes you guessed it, it was the size of about one space worth of text.

So the tooltip can be triggered by the length of text originally entered when adding the treeview item even if your not using that text yourself (for example in custom draw situations). I found that I could specify say 13 spaces to trigger the tooltip to show over just part of the item, but not the whole item, or if i specified like lots of spaces, then I could ensure the tooltip triggered over the whole item.

Hope the information might be useful to someone. I hopefully will have a new program that I'm working on, uploaded at some point, to show the custom drawn treeview, and it might help illustrate the issue and solution better.

jj2007