This is something I’ve had on my “to-write”-list for some time now.
When I started working on Feed Vortex I wanted to have a treeview with the feeds you we’re subscribed to and when you’d have unread articles the feed would have its name in a bold font and the number of unread articles would be in paranthesis behind the name of the feed.
It was pretty simple: just get the font object from the treenode, make it bold and put it back. Easy as that.
Until I looked at the treeview. The longest feed label seemed truncated. I first thought this had to do with the window I had put the treeview on, but this wasn’t the case. It turns out that the treeview determines how much space it should reserve for its labels only when you create it, or add a new treenode to it. Basing it on the font it has at that time.
So the solution was actually pretty simple. Create the treeview with a bold font by default and then add a treenode with a regular font. The other way around doesn’t work. Also, just to be sure, I added some additional spaces to the end of the label, just to make absolutely sure I have enough space left to display the label when I set the font to bold.
[Last played: Nightwish - Beauty Of The Beast]