Thread Tools Display Modes
04/19/16, 10:45 PM   #1
uladz
AddOn Author - Click to view addons
Join Date: Feb 2016
Posts: 11
Question Reset or reinitialize a tooltip?

Guys, is there a way to reset and force reinitialization of a tooltip control? Basically what I'm trying to do is to add different info to an item tooltip depending on which keys are pressed and I want to do it on-the-fly, i.e. when I mouse over an item in my inventory and get a tooltip then when I press Shift then I get some extra info added to this tooltip, when I release Shift the extra info has to go away. So far I was able only to add extra info to tooltip on Shift but I can not remove it. Was looking for functions that would allows me to force reset of this tooltip but could not find anything working. Any hints or ideas would be much appreciated.
  Reply With Quote
04/20/16, 01:10 AM   #2
@AlphaLemming
 
@AlphaLemming's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 122
Make a own control (Label, Button, Texture ...) and use:

Code:
Shift pressed:
  Tooltip:AddControl(YourControl)
  YourControl:SetAnchor(CENTER)
  YourControl:SetHidden(false)

Shift released:
  YourControl:SetHidden(true)
  YourControl:ClearAnchors()
Where Tooltip is your Tooltip-Control.
  Reply With Quote
04/20/16, 02:39 PM   #3
uladz
AddOn Author - Click to view addons
Join Date: Feb 2016
Posts: 11
ic, thank you for the idea! Right now I just use AddLine() to append text at the bottom of a tooltip to expand it's size, and which I can not hide. Now if I create a control and add it to the tooltip would it resize the tooltip accordingly to fit it in. The same for hiding, would it resize it back to "normal" size with my control hidden. The control I would have to add would be just a simple text box at this case.
  Reply With Quote
04/21/16, 01:01 AM   #4
@AlphaLemming
 
@AlphaLemming's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 122
AddLine() cannot removed without parsing the whole tooltip ... bad, only for oneshot-infos.
You should use AddControl() with your TextBox. A ClearAnchors() will remove it from the position and should resize the tooltip to its size before.
With the new CraftStore i use TopLevelControls and anchor them inside or outside the tooltip-control, because with AddControl() you can only use SetAnchor(CENTER). Disadvantage is, they must be hidden by a PreHook, because they not hide with the tooltip.
  Reply With Quote
04/21/16, 02:46 PM   #5
uladz
AddOn Author - Click to view addons
Join Date: Feb 2016
Posts: 11
Thank you! I'll try out this way and post my results here. Shouldn't much work to convert to controls from lines I guess.
  Reply With Quote
04/22/16, 06:13 AM   #6
uladz
AddOn Author - Click to view addons
Join Date: Feb 2016
Posts: 11
All good, now it's working as I want it to, though it wasn't as streight forward and I have imagined. Took a good 6 hours to debug everything and get it ready for release. The problem was with correct alignment of all controls and label so that when you hide all elements then a tooltip would be restored back to it's original size and layout. Plus there were couple of other issues with layout that I have to workaround. Anyway, all works now smoothly, will be releasing with the next version of Price Tracker. Thank you for the help!
  Reply With Quote
04/22/16, 08:22 AM   #7
Scootworks
 
Scootworks's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2014
Posts: 312
Originally Posted by uladz View Post
All good, now it's working as I want it to, though it wasn't as streight forward and I have imagined. Took a good 6 hours to debug everything and get it ready for release. The problem was with correct alignment of all controls and label so that when you hide all elements then a tooltip would be restored back to it's original size and layout. Plus there were couple of other issues with layout that I have to workaround. Anyway, all works now smoothly, will be releasing with the next version of Price Tracker. Thank you for the help!

always when i here: update/new version of price tracker, i start to smile! thanks
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Reset or reinitialize a tooltip?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off