-
Notifications
You must be signed in to change notification settings - Fork 87
Update text in shown tooltip #1603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update text in shown tooltip #1603
Conversation
8c54a99 to
95d05ec
Compare
Flamefire
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Triggered by the "mutable" I feel this is the wrong approach: WindowManager already knows the currently shown tooltip (used for hiding it)
So how about adding a "UpdateTooltip" method to WindowManager that works similarly to WindowManager::SetToolTip in checking if the currently shown tooltip is "THIS"? Or even better: Add an extra param to WindowManager::SetToolTip: bool updateCurrent = false to combine that into a single function. Maybe even use updateCurrent = updateCurrent || tooltip.empty() and do the check at
s25client/libs/s25main/WindowManager.cpp
Line 839 in bdf4110
| if(curTooltip && (!ttw || curTooltip->getShowingCtrl() == ttw)) |
updateCurrent (now) is set.)
Great. I was unaware of this.
I think
|
Add a parameter (bool updateCurrent) to the WindowManager::SetToolTip() function, to update the text of the currently displayed tooltip.
When a tooltip's text is changed, ask the WindowManager to update the currently shown tooltip. The call is only effective if the tooltip is actually being shown.
95d05ec to
25b3e78
Compare
Can you elaborate? Anyway your solution works too 👍 |
Oh, right, because you would have just taken the branch re-creating the tooltip. Of course, the |
|
FYI, I have just confirmed that this does in fact work by testing these commits against #1604. |
When a tooltip is currently being shown and its text is changed, update the displayed text.