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

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 11 Aug 2009 09:03:38 +0200 CEST

Ryan Leavengood <leavengood@xxxxxxxxx> wrote:
> 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.

Obviously, the BTextToolTip class isn't very useful if you want to use 
it like that :-)
But the fact that SetText() may you drop into the debugger 
unconditionally is surely annoying, and deserves an API fix (give me a 
sec :-)).

Besides that, I also noticed that the BTextView in there sometimes 
returns a too small preferred size, which is something someone might 
want to look into, too. I'll open a bug report for this.

Bye,
   Axel.


Other related posts: