Thread Tools Display Modes
05/14/17, 08:14 AM   #1
Alaren96
 
Alaren96's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2017
Posts: 8
Question Tooltips on label control ?

I know how to add a tooltip to say a checkbox control, but was wondering if it was possible to add one to a label control as it doesn't seem to work ?
  Reply With Quote
05/14/17, 08:49 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
If you mean a text tooltip it should work the same as with the checkbox.
Use the OnMouseEnter handler to show, and OnMouseExit handler to hide the text tooltip.

Something like that:

myControl is your label control.
e.g. set the tooltip text to the label itseelf before
myControl.tooltipText = "Test tooltip text"

Lua Code:
  1. myControl:SetHandler("OnMouseEnter", function(self)
  2.   ZO_Tooltips_ShowTextTooltip(self, BOTTOM, self.tooltipText)
  3. end)
  4.  
  5. myControl:SetHandler("OnMouseExit", function(self)
  6.    ZO_Tooltips_HideTextTooltip()
  7. end)
  Reply With Quote
05/14/17, 09:23 AM   #3
Alaren96
 
Alaren96's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2017
Posts: 8
Yes, tried that, and it doesn't work..

Code:
function EnchMaker.tooltip(ctrl,text)
    ctrl:SetHandler("OnMouseEnter", function(self) ZO_Tooltips_ShowTextTooltip(self, TOP, text) end)
    ctrl:SetHandler("OnMouseExit", function(self)  ZO_Tooltips_HideTextTooltip() end)
end

EnchMaker.tooltip(cboxControl,"Some Text")   -- Works
EnchMaker.tooltip(labelControl,"Some Text")   -- Doesn't work
  Reply With Quote
05/14/17, 10:02 AM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
Hm, perhaps the label control is child of another control and the mouse enter isn't executed somehow?
Is there a parent control of the label, where you could add the tooltip handler functions?
  Reply With Quote
05/14/17, 10:18 AM   #5
Alaren96
 
Alaren96's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2017
Posts: 8
We're dealing with 3 controls..

A backdrop which is basically an area where other controls are added, and two virtual controls, a checkbox and a label..

Lua Code:
  1. <Backdrop name="$(parent)SearchBG" inherits="ZO_ThinBackdrop">
  2.     <Dimensions x="830" y="390" />
  3.     <Anchor point="TOPLEFT" offsetX="10" offsetY="80" />
  4. </Backdrop>
  5.  
  6. <Button name="EnchantMakerCheckBox" inherits="ZO_CheckButton" virtual="true" text="">
  7.     <Dimensions x="20" y="20" />
  8.     <Anchor point="TOPLEFT" offsetX="50" offsetY="50" />
  9. </Button>
  10.  
  11. <Label name="EnchantMakerCheckBoxText" font="ZoFontGame" color="INTERFACE_COLOR_TYPE_TEXT_COLORS:INTERFACE_TEXT_COLOR_NORMAL" virtual="true" text="">
  12.     <Anchor point="LEFT" relativePoint="RIGHT" offsetX="10" />
  13. </Label>

The checkbox is added to the backdrop control first and then the label control is added as a child of the checkbox..

Lua Code:
  1. cboxControl = CreateControlFromVirtual(controlName, EnchantMakerSearchBG, "EnchantMakerCheckBox")
  2. labelControl = CreateControlFromVirtual(controlName .. "Text", cboxControl, "EnchantMakerCheckBoxText")
  Reply With Quote
05/14/17, 01:45 PM   #6
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Do not forget to use
xml:
Code:
 mouseEnabled="true"
Lua:
Lua Code:
  1. control:SetMouseEnabled(true)
Without the events are not triggered.
  Reply With Quote
05/14/17, 03:50 PM   #7
Alaren96
 
Alaren96's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2017
Posts: 8
Excellent! thanks Votan, that works just fine now.. It wasn't a matter of remembering it, more like not having a clue The button (ZO_CheckButton) must have the mouse events auto wired, whereas the label doesn't.
  Reply With Quote
05/16/17, 02:35 AM   #8
manavortex
 
manavortex's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 138
You'll probably do posterity a favour if you update the esoui wiki with this!
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Tooltips on label control ?

Thread Tools
Display Modes

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