[haiku-development] Proper method to dynamically update tool tips

  • From: Ryan Leavengood <leavengood@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Mon, 10 Aug 2009 18:09:02 -0400

I wanted to start using the new tool tips to make Icon-O-Matic more
usable. The first thing I wanted to do was add a tool tip for the
alpha slider since as far as I can see there is no way to see the
exact value.

At first I was going to make my own custom BStringView subclass but
then I figured I could just use BTextToolTip which allows updating of
the text. So in the AlphaSlider class I use SetToolTip in the
constructor to set up the tool tip and then in the SetValue method I
use dynamic_cast<BTextToolTip*>(ToolTip())->SetText(text) to set the
text. Most of the time this works, but if update the value while the
tool tip is showing I go to the debugger for not locking the tool tip
window (I assume.) But I don't see how to lock this window from
outside of the tool tip.

So I don't know how usable the BTextToolTip class is like this. If
there is a certain locking strategy that should be used here, let me
know.

Otherwise I suppose I can just use my own BStringView subclass and
send it update messages.

As a sidenote I think every icon uses a slightly different alpha for
the shadow, which annoys me. I think we should set a standard for that
in the icon guidelines and over time we can update the old icons.
Being able to see the alpha value with this new tool tip should help.

-- 
Regards,
Ryan

Other related posts: