#14603 closed defect (fixed)

Refreshing of SuperTooltip

Reported by: Adamb Owned by:
Priority: normal Milestone:
Component: AGW Version:
Keywords: tooltip Cc:
Blocked By: Blocking:
Patch: yes

Description

First of all - SuperTooltip is a nice feature, that deserves giving it a try. However, looks like it needs bit of fresh air, so here it comes (Get yourself a pack of popcorn and enjoy reading!):

SuperTooltip, or The Sum of All Fears:

  1. Shadows and rounded corners are available on windows later than XP, so checking for an exact OS version restricts tooltip too much. Patch changes it, checking if OS is later than XP
  1. ToolTipWindowBase.CalculateBestSize is almost a copy of ToolTipWindowBase.OnPaint - a tiny change to the latter makes CalculcateBestSize fit within 2 lines instead of ~80.
  1. Speaking about ToolTipWindowBase.OnPaint - it's spanning over 150 lines and has numerous repetitions, making it harder to read and/or change behaviour in subclass. Patch slightly improves method readability.
  1. There's a method SuperToolTip.DoShowNow() for instant display of tooltip, but there's no 'DoHide()' method for instant closing it. Patch adds a DoCloseNow() method. Naming was chosen to be consistent with DoShowNow()
  1. EVT_KILL_FOCUS is bound to tooltip window itself. Maybe it has some reason I can't see (tooltip on wx.MSW doesn't seem to have focus at all). However it seems most reasonable to bind handler to EVT_KILL_FOCUS emitted by a parent of tooltip, so when tooltip is shown and user pressses ALT+Tab, tooltip can be destroyed. Currently it just remains visible, even when its parent is hidden. Patch actually replaces current binding of EVT_KILL_FOCUS with one to parent, but as I said - maybe it's not an error and there's some reason EVT_KILL_FOCUS on tooltip should be handled (Mac or GTK port may behave differently).
  1. Tooltip body text can contain a link. But how user is supposed to click it, since tooltip disappears whenever mouse cursor leaves widget area and tooltip is displayed outside this area? My patch does nothing with this, because it's not clear to me what behaviour would be correct here. Displaying tooltip next to mouse cursor seems like a good idea, but it changes behaviour, so I want someone to confirm that it should be done that way. Actually, due to issues 5. and 7., user can hide widget and then move mouse onto visible tooltip to click a link, but well... it's a hack, not a feature
  1. TooltipWindowBase.OnWidgetLeave ignores events which take place inside widget rectangle, so when widget is partially obscured by some other window and user moves mouse over that other window - tooltip is still shown. Patch fixes it.
  1. SuperToolTip.EnableTip doesn't stop self._startTimer, so tooltip can be still shown if SuperToolTip.EnableTip(False) has been called after ToolTipWindowBase.OnWidgetEnter() has been processed. Patch fixes that.
  1. There's no way to check if tip is enabled outside of SuperToolTip class. Patch adds IsEnabled() method that returns boolean value.

Attachments (1)

wx-agw-supertooltip-patch.diff download (14.2 KB) - added by Adamb 20 months ago.
Patch for trunk version of wxPython/3rdParty/AGW/agw/supertooltip.py file

Download all attachments as: .zip

Change History (3)

Changed 20 months ago by Adamb

Patch for trunk version of wxPython/3rdParty/AGW/agw/supertooltip.py file

comment:1 Changed 20 months ago by Adamb

Forgot to mention this in ticket: I've been testing my changes on MS Windows only (don't have machine with Linux nor OSX).

comment:2 Changed 20 months ago by AG

  • Resolution set to fixed
  • Status changed from new to closed

(In [72372]) - CustomTreeCtrl and HyperTreeList: remove wrong comma in CustomTreeCtrl (closes #14610), and add the ability to customize item border colours (closes #14609);

  • SuperToolTip: huge refactor of the code base - thanks to Adam for the patch. Closes #14603.
Note: See TracTickets for help on using tickets.