Re: Ellipsizing

I had the same desire and arrived at this method. I can't vouch for whether it works in every situation, but it has never seemed to fail for me.

The idea is that you force the full natural request by setting :max-width-chars to -1, get that request, then check whether it's below the actual allocation and en/disable the tooltip accordingly. then, of course, change :max-width-chars back to something that allows ellipsisation

so, in short:
  • set_max_width_chars(-1);
  • get_preferred_width(dummy, natural);
  • set_has_tooltip( natural < get_allocated_width() );
  • set_max_width_chars(0);

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]