Thread Tools Display Modes
03/06/15, 07:42 AM   #1
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 1,019
New in XML.. Tooltips doesn't work..

Heya here,

So another addon for me and this time a lot of XML inside it.

So, I've set a huge block which works a bit, but, I'm now having a problem on adding tooltips or make them "clickable"

Think it's a little forgive, but I looked a bit, so, here is my snippets..

PS: If I /zgoo mouse my button, it doesn't show my button, but the parent object, it's maybe that ?

A button that need a tooltip is delcared as you see below i've dropped a lot of buttons for the copy/paste).


Lua Code:
  1. <GuiXml>
  2.     <Controls>
  3.         <TopLevelControl name="SuperStarXML" mouseEnabled="true" movable="true" hidden="true" clampedToScreen="true">
  4.             <Dimensions x="650" y="588" />
  5.             <Anchor point="CENTER" relativePoint="CENTER" offsetX="0" offsetY="0" />
  6.             <ClampedToScreenInsets left="16" top="0" right="0" bottom="0" />
  7.             <Controls>
  8.                 <Backdrop name="$(parent)BG" integralWrapping="true">
  9.                     <Anchor point="TOPLEFT" offsetX="-8" offsetY="-6"/>
  10.                     <Anchor point="BOTTOMRIGHT" offsetX="4" offsetY="4"/>
  11.                     <Edge file="EsoUI/Art/ChatWindow/chat_BG_edge.dds" edgeFileWidth="256" edgeFileHeight="256" edgeSize="32"/>
  12.                     <Center file="EsoUI/Art/ChatWindow/chat_BG_center.dds" />
  13.                     <Insets left="32" top="32" right="-32" bottom="-32" />
  14.                 </Backdrop>
  15.                
  16.                 <Label name="$(parent)Title" font="ZoFontBookTablet" color="INTERFACE_COLOR_TYPE_TEXT_COLORS:INTERFACE_TEXT_COLOR_NORMAL">
  17.                     <Anchor point="BOTTOM" relativeTo="$(parent)" relativePoint="TOP" offsetX="0" offsetY="50" />
  18.                 </Label>
  19.                
  20.                 <Button name="$(parent)Lord8" font="ZoFontGame" color="INTERFACE_COLOR_TYPE_TEXT_COLORS:INTERFACE_TEXT_COLOR_NORMAL" horizontalAlignment="LEFT" mouseEnabled="true">
  21.                     <Anchor point="RIGHT" relativeTo="$(parent)Lord" relativePoint="LEFT" offsetX="450" offsetY="0" />
  22.                 </Button>
  23.                
  24.             </Controls>
  25.         </TopLevelControl>
  26.     </Controls>
  27. </GuiXml>


Lua Code:
  1. -- Yes I used some code here ^^
  2.  
  3. SuperStarXML:GetNamedChild(SuperStar.disciplines[disciplineIndex] .. skillIndex):SetText(pointsSpent) -- This code works well
  4. SuperStarXML:GetNamedChild(SuperStar.disciplines[disciplineIndex] .. skillIndex):SetHandler("OnMouseEnter", function(self) SuperStar.ShowTooltip(self) end) -- Doesn't show anything
  5. SuperStarXML:GetNamedChild(SuperStar.disciplines[disciplineIndex] .. skillIndex):SetHandler("OnMouseExit", function(self) SuperStar.HideTooltip(self) end)
  6.  
  7. function SuperStar.ShowTooltip(self)
  8.  
  9.     --InitializeTooltip(tooltipControl, [owner, point, offsetX, offsetY, relativePoint])
  10.     InitializeTooltip(InformationTooltip, self, TOPRIGHT, 0, 5, BOTTOMRIGHT)
  11.     --SetTooltipText(tooltipControl, text, [r, g, b])
  12.     SetTooltipText(InformationTooltip, "Some text")
  13.     --or you can use:
  14.     --tooltipControl:AddLine(text, [font, r, g, b, lineAnchor, modifyTextType, textAlignment, setToFullSize]), default font = ""
  15.     --tooltipControl:AddVerticalPadding(offsetY)
  16.    
  17. end
  18.  
  19. function SuperStar.HideTooltip(self)
  20.     ClearTooltip(InformationTooltip)
  21. end


I've also tried this :

Lua Code:
  1. <Button name="$(parent)LordTot" font="ZoFontGameLargeBoldShadow" color="INTERFACE_COLOR_TYPE_TEXT_COLORS:INTERFACE_TEXT_COLOR_NORMAL" horizontalAlignment="LEFT" mouseEnabled="true">
  2.         <Anchor point="RIGHT" relativeTo="$(parent)Lord" relativePoint="LEFT" offsetX="530" offsetY="0" />
  3.         <OnMouseEnter>
  4.             ZO_Tooltips_ShowTextTooltip(self, TOP, "blablabla")
  5.         </OnMouseEnter>
  6.         <OnMouseExit>
  7.             ZO_Tooltips_HideTextTooltip()
  8.         </OnMouseExit>
  9. </Button>


And also this :


Lua Code:
  1. SuperStarXML:GetNamedChild(SuperStar.disciplines[disciplineIndex] .. skillIndex):SetHandler("OnMouseEnter", function(self)
  2.     ZO_Tooltips_ShowTextTooltip(self, TOP, "blablabla")
  3. end)
  4. SuperStarXML:GetNamedChild(SuperStar.disciplines[disciplineIndex] .. skillIndex):SetHandler("OnMouseExit", function(self)
  5.     ZO_Tooltips_HideTextTooltip()
  6. end)


I'll also, for a later usage need some skill tooltips. I was planning in using this code :

Lua Code:
  1. InitializeTooltip(SkillTooltip, GetChampionPointAttributeIcon(GetChampionDisciplineAttribute(disciplineIndex)), LEFT, 150, 0, CENTER)
  2. SkillTooltip:SetChampionSkillAbility(disciplineIndex, skillIndex, 0)

which doesn't work either.

I've surely missed something, maybe in my copy paste, but if anyone knows ? thanks

Last edited by Ayantir : 03/06/15 at 07:48 AM.
  Reply With Quote
03/06/15, 08:03 AM   #2
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by Ayantir View Post
Heya here,

So another addon for me and this time a lot of XML inside it.

So, I've set a huge block which works a bit, but, I'm now having a problem on adding tooltips or make them "clickable"

Think it's a little forgive, but I looked a bit, so, here is my snippets..

PS: If I /zgoo mouse my button, it doesn't show my button, but the parent object, it's maybe that ?

A button that need a toolt
Try to add mouseEnabled="true" to your button. It seems that you have enabled mouse events just for top level window (parent).
  Reply With Quote
03/06/15, 08:05 AM   #3
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by Ayantir View Post
PS: If I /zgoo mouse my button, it doesn't show my button, but the parent object, it's maybe that ?
button:SetMouseEnabled(true)

Originally Posted by Ayantir View Post
I'll also, for a later usage need some skill tooltips. I was planning in using this code :

Lua Code:
  1. InitializeTooltip(SkillTooltip, GetChampionPointAttributeIcon(GetChampionDisciplineAttribute(disciplineIndex)), LEFT, 150, 0, CENTER)
  2. SkillTooltip:SetChampionSkillAbility(disciplineIndex, skillIndex, 0)
The second argument to InitializeTooltip is owner control, you probably want to pass your button there. It is used for anchoring and also when the owner control is hidden, the tooltip goes with it.
  Reply With Quote
03/06/15, 08:36 AM   #4
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 1,019
Thank you,

But no, it doesn't work

(I had already mouseEnabled my button in xml), and if I

Lua Code:
  1. SuperStarXML:GetNamedChild(SuperStar.disciplines[disciplineIndex] .. skillIndex):SetMouseEnabled(true)

it's same problem.

And in zgoo, the button is well enabled (same if I only set mouEnabled in xml).



It's like my buttons are in the background and totally inactive.

The second argument to InitializeTooltip is owner control, you probably want to pass your button there. It is used for anchoring and also when the owner control is hidden, the tooltip goes with it.

2015-03-06T15:33:21.625+01:00 |cff0000Lua Error: EsoUI/Libraries/ZO_Templates/Tooltip.lua:59: attempt to index a nil value
stack traceback:
EsoUI/Libraries/ZO_Templates/Tooltip.lua:59: in function 'InitializeTooltip'
user:/AddOns/SuperStar/SuperStar.lua:153: in function 'SuperStar.calculateStats'
user:/AddOns/SuperStar/SuperStar.lua:32: in function 'SuperStar.onAddonLoaded'|r
When trying to use

Lua Code:
  1. InitializeTooltip(SuperStarXMLWarriorLordTot, GetChampionPointAttributeIcon(GetChampionDisciplineAttribute(disciplineIndex)), LEFT, 150, 0, CENTER)
  2. SuperStarXMLWarriorLordTot:SetChampionSkillAbility(disciplineIndex, skillIndex, 0)

(or local mybutton = SuperStarXMLWarriorLordTot)
  Reply With Quote
03/06/15, 09:09 AM   #5
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Hi, Ayantir.

Originally Posted by Ayantir View Post
When trying to use

Lua Code:
  1. InitializeTooltip(SuperStarXMLWarriorLordTot, GetChampionPointAttributeIcon(GetChampionDisciplineAttribute(disciplineIndex)), LEFT, 150, 0, CENTER)
  2. SuperStarXMLWarriorLordTot:SetChampionSkillAbility(disciplineIndex, skillIndex, 0)

(or local mybutton = SuperStarXMLWarriorLordTot)
The first argument should be the tooltip to initialize. (SkillTooltip)
line 59 is tooltip:ClearLines() (with tooltip as 1. argument)
I'm currently at work and can not verify, but shouldn't Button be the parent of BackDrop and Label?

CU
  Reply With Quote
03/06/15, 10:27 AM   #6
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
InitializeTooltip(SkillTooltip, SuperStarXMLWarriorLordTot, LEFT, 150, 0, CENTER)
SkillTooltip:SetChampionSkillAbility(disciplineIndex, skillIndex, 0)
  Reply With Quote
03/19/15, 05:44 PM   #7
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 1,019
Thanks for your messages,

The final conclusion :

Button don't accept tooltips without an inherit (at list inherit="ZO_DefaultTextButton") .
You must use labels.

If you need to use a button, you can cheat with
button:GetLabelControl():SetHandler("OnMouseUp", etc)
  Reply With Quote
03/19/15, 10:31 PM   #8
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
It wont work because your button has no hit box...Its dimensions are 0 width 0 height, the OnMouseEnter event will not fire. Thats the same reason /zgoo mouse wont show you the control and why you can't click it. Your mouse isn't over the button because it has no dimensions.

Just add dimensions to the button and it works:
xml Code:
  1. <Button name="$(parent)Lord8" font="ZoFontGame" text="test text" color="INTERFACE_COLOR_TYPE_TEXT_COLORS:INTERFACE_TEXT_COLOR_NORMAL" horizontalAlignment="LEFT" mouseEnabled="true">
  2.     <Dimensions x="128" y="28" />
  3.     <Anchor point="RIGHT" relativeTo="$(parent)Lord" relativePoint="LEFT" offsetX="450" offsetY="0" />
  4.  
  5.     <OnMouseEnter>
  6.         SuperStar_ShowTooltip(self)
  7.     </OnMouseEnter>
  8.  
  9.     <OnMouseExit>
  10.         SuperStar_HideTooltip(self)
  11.     </OnMouseExit>
  12. </Button>

Lua Code:
  1. function SuperStar_ShowTooltip(self)
  2.     InitializeTooltip(InformationTooltip, self, TOPRIGHT, 0, 5, BOTTOMRIGHT)
  3.     SetTooltipText(InformationTooltip, "Some text")
  4. end
  5.  
  6. function SuperStar_HideTooltip(self)
  7.     ClearTooltip(InformationTooltip)
  8. end

Last edited by circonian : 03/19/15 at 10:35 PM.
  Reply With Quote
03/19/15, 10:35 PM   #9
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 1,019
huhu thank you
  Reply With Quote

ESOUI » AddOns » AddOn Help/Support » New in XML.. Tooltips doesn't work..


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