Thread Tools Display Modes
08-13-09, 08:59 AM   #1
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Tooltips and XML

Okay so i have been able to make tooltips on LUA created buttons but how do i put a tooltip on xml stuff? tried using similar code to whats in my LUA files but no go.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
08-25-09, 09:12 PM   #2
Cidwel
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 23
Hi! I

I need the same thing, but I'm using XML created buttons. I tried to find over the internets without any result :S
  Reply With Quote
08-26-09, 12:41 AM   #3
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 199
Well, it's basically the same approach as in Lua, because it is Lua :
The only difference is that you have to use the global "this" instead of "self".

Code:
-- In the OnEnter-Script
GameTooltip:SetOwner(this, "ANCHOR_RIGHT")
GameTooltip:AddLine("Some text")
GameTooltip:Show()

-- In the OnLeave-Script
GameTooltip:Hide()
Make sure that the frame is mouse-enabled, so has either set "this:EnableMouse(true)" or the equivalent XML-attribute (enableMouse="true") defined.
__________________
« Website | GitHub »

Oh hai!
  Reply With Quote
08-26-09, 08:57 AM   #4
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
maybe thats where i had my problem. i tried to use lua in the xml to do the tooltips but it didnt work. gonna try what you just said see how that works out.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
08-26-09, 11:27 AM   #5
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
So i tested that... hmm it looks like if your not careful how you anchor the tooltip can cause a memory leak that causes wow to crash on load or reload. as long as its right though it works fine. final code looks like this....

Code:
</Button>
            <Button name="$InviteButton" frameStrata="HIGH" hidden="true">
        <!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508884-59c2-4f83-ae10-27aaad48391b" />-->
        <Size>
          <AbsDimension x="15" y="15" />
        </Size>
        <Anchors>
          <Anchor point="CENTER">
            <Offset>
              <AbsDimension x="51" y="-27" />
            </Offset>
          </Anchor>
        </Anchors>
        <Scripts>
		<OnLoad>self:RegisterEvent("PLAYER_TARGET_CHANGED") self:RegisterEvent("PARTY_MEMBERS_CHANGED")
self:Hide()</OnLoad>
          <OnEvent>if UnitIsFriend("player","target") and UnitIsPlayer("target") and not UnitInParty("target") then
self:Show()
else
self:Hide()
end</OnEvent>
<OnEnter>GameTooltip:SetOwner(this, "ANCHOR_RIGHT")
GameTooltip:AddLine("Invite")
GameTooltip:Show()
</OnEnter>
<OnLeave>GameTooltip:Hide()</OnLeave>
        <OnClick>local name = UnitName("target");
        InviteUnit(name)</OnClick>
        </Scripts>
        <NormalTexture file="Interface\AddOns\GrimUIcore\Icons\InviteIcon">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </NormalTexture>
        <PushedTexture file="Interface\AddOns\GrimUIcore\Icons\InviteIcon">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </PushedTexture>
        <DisabledTexture file="Interface\AddOns\GrimUIcore\Icons\InviteIcon">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </DisabledTexture>
        <HighlightTexture file="Interface\AddOns\GrimUIcore\Icons\InviteIcon" alphaMode="ADD">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </HighlightTexture>
        <ButtonText name="$parentText">
          <FontHeight>
            <AbsValue val="10" />
          </FontHeight>
        </ButtonText>
        <NormalFont style="GameFontNormal" />
        <HighlightFont style="GameFontHighlight" />
        <DisabledFont style="GameFontDisable" />
      </Button>
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
08-26-09, 11:45 AM   #6
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
what were you trying before that was causing the memory leak/crash?
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
08-26-09, 11:51 AM   #7
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
i was trying things like

<OnEnter>GameTooltip:SetOwner(this, "ANCHOR_NONE")
GameTooltip:AddLine("Invite")
GameTooltip:Show()
</OnEnter>


also tried changing this to uiparent and anchor none to cursor and tried putting other things in and dif combination's. i would prefer the tooltip show up on the far left side of the screen with all other game tooltips but....

anything i try other then what was originally said does not work although... im not so sure now that this was the cause because its doing it intermittently right or not. Not sure what is going on other then maybe i have just overloaded wow's addon mem usage ability's.

msg says basically i have overloaded the mempool with lua code. i stuck another 2gigs of ram in a minute ago and its still doing it so my only thought is there is a leak somewhere but why would it be intermittent and what would it have to do with the tooltip code because thats when it started....
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
08-26-09, 12:04 PM   #8
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
1. Did you try not changing the tooltip's owner? (ie, leaving that line out) (Don't remember what that will do, as I always like the tooltips over my config elements when I make them)

2. Try using GameTooltip:SetText("Invite") instead of :AddLine() (Shouldn't make a difference, but try it anyway.)

Other than that... I don't know. It shouldn't be causing a memory leak (did you actually check to see if it was your addon that was increasing in memory). But I don't use xml at all, so...
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
08-26-09, 12:11 PM   #9
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 199
You could try using GameTooltip_SetDefaultAnchor(GameTooltip, this) instead of :SetOwner().
The owner indicates to which frame the GameTooltip currently belongs and will be cleared on every Hide(). I don't know if it is mandatory, but even the SetDefaultAnchor()-method calls internal :SetOwner(this, "ANCHOR_NONE").

Never heard of such a memory leak.
__________________
« Website | GitHub »

Oh hai!
  Reply With Quote
08-26-09, 12:12 PM   #10
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
haha yea everyone keeps telling me that. for the moment i have issues creating frames with lua though i have issues in general hahaha i have not checked thoroughly yet as far as if my addon is incing mem in game at some out ragious rate but i did glance at the top 3 and it was not in them so... figure as long as im still below questhelper im good rofl. im not exactly sure whats causing this mem problem next time it happens ill paste the windows error msg here.

Either way one would think if it was a mem leak it would not be intermittent or happen during /reload
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
08-26-09, 12:14 PM   #11
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
as a side thought.... maybe my ram is just crapping out. i hope not.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
08-26-09, 12:27 PM   #12
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Okay i looked into it more and yes HUGE! jump in usage when i target things especially on people who cause all of my targeting buttons to appear.
but it only seems to crash when i change the anchor info in certain ways.
maybe lol.
here is the whole code...

Code:
<Ui xmlns="http://www.blizzard.com/wow/ui" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <!--Autogenerated by wowuides, Version=1.0.300.0, Culture=neutral, PublicKeyToken=null-->
  <Frame name="GrimUIcoreArtB1" parent="UIParent" frameStrata="BACKGROUND" frameLevel="1">
    <!--<FrameSkin skinid="f15d4970-d66d-444e-bb2d-1ad102c87fed" frameid="f15d4971-d66d-444e-bb2d-1ad102c87fed" />-->
    <Size>
      <AbsDimension x="468" y="238" />
    </Size>
    <Anchors>
      <Anchor point="BOTTOMLEFT" relativeTo="UIParent">
        <Offset>
          <AbsDimension x="0" y="0" />
        </Offset>
      </Anchor>
    </Anchors>
    <Backdrop bgFile="interface\AddOns\GrimUIcore\Art\Bottom1">
      <BackgroundInsets>
        <AbsInset left="0" right="0" top="0" bottom="0" />
      </BackgroundInsets>
      <TileSize>
        <AbsValue val="0" />
      </TileSize>
      <EdgeSize>
        <AbsValue val="0" />
      </EdgeSize>
    </Backdrop>
  </Frame>
<Frame name="GrimUIcoreArtB4" parent="UIParent" frameStrata="BACKGROUND" frameLevel="2">
    <!--<FrameSkin skinid="f15d4970-d66d-444e-bb2d-1ad102c87fed" frameid="f15d4971-d66d-444e-bb2d-1ad102c87fed" />-->
    <Size>
      <AbsDimension x="474" y="238" />
    </Size>
    <Anchors>
      <Anchor point="BOTTOMRIGHT" relativeTo="UIParent">
        <Offset>
          <AbsDimension x="0" y="0" />
        </Offset>
      </Anchor>
    </Anchors>
    <Backdrop bgFile="interface\AddOns\GrimUIcore\Art\Bottom4">
      <BackgroundInsets>
        <AbsInset left="0" right="0" top="0" bottom="0" />
      </BackgroundInsets>
      <TileSize>
        <AbsValue val="0" />
      </TileSize>
      <EdgeSize>
        <AbsValue val="0" />
      </EdgeSize>
    </Backdrop>
  </Frame>
<Frame name="GrimUIcoreArtB2" parent="UIParent" frameStrata="BACKGROUND" frameLevel="1">
    <!--<FrameSkin skinid="f15d4970-d66d-444e-bb2d-1ad102c87fed" frameid="f15d4971-d66d-444e-bb2d-1ad102c87fed" />-->
    <Size>
      <AbsDimension x="578" y="238" />
    </Size>
    <Anchors>
      <Anchor point="BOTTOM" relativeTo="UIParent">
        <Offset>
          <AbsDimension x="-210" y="0" />
        </Offset>
      </Anchor>
    </Anchors>
    <Backdrop bgFile="interface\AddOns\GrimUIcore\Art\Bottom2">
      <BackgroundInsets>
        <AbsInset left="0" right="0" top="0" bottom="0" />
      </BackgroundInsets>
      <TileSize>
        <AbsValue val="0" />
      </TileSize>
      <EdgeSize>
        <AbsValue val="0" />
      </EdgeSize>
    </Backdrop>
  </Frame>
<Frame name="GrimUIcoreArtB3" parent="UIParent" frameStrata="BACKGROUND" frameLevel="1">
    <!--<FrameSkin skinid="f15d4970-d66d-444e-bb2d-1ad102c87fed" frameid="f15d4971-d66d-444e-bb2d-1ad102c87fed" />-->
    <Size>
      <AbsDimension x="440" y="238" />
    </Size>
    <Anchors>
      <Anchor point="BOTTOM" relativeTo="UIParent">
        <Offset>
          <AbsDimension x="295" y="0" />
        </Offset>
      </Anchor>
    </Anchors>
    <Backdrop bgFile="interface\AddOns\GrimUIcore\Art\Bottom3">
      <BackgroundInsets>
        <AbsInset left="0" right="0" top="0" bottom="0" />
      </BackgroundInsets>
      <TileSize>
        <AbsValue val="0" />
      </TileSize>
      <EdgeSize>
        <AbsValue val="0" />
      </EdgeSize>
    </Backdrop>
  </Frame>
<Frame name="GrimUIcoreArtMM" parent="UIParent" frameStrata="LOW" frameLevel="1">
    <!--<FrameSkin skinid="f15d4970-d66d-444e-bb2d-1ad102c87fed" frameid="f15d4971-d66d-444e-bb2d-1ad102c87fed" />-->
    <Size>
      <AbsDimension x="253" y="253" />
    </Size>
    <Anchors>
      <Anchor point="BOTTOM" relativeTo="UIParent">
        <Offset>
          <AbsDimension x="-40" y="-81" />
        </Offset>
      </Anchor>
    </Anchors>
    <Backdrop bgFile="interface\AddOns\GrimUIcore\Art\MinimapBorder">
      <BackgroundInsets>
        <AbsInset left="0" right="0" top="0" bottom="0" />
      </BackgroundInsets>
      <TileSize>
        <AbsValue val="0" />
      </TileSize>
      <EdgeSize>
        <AbsValue val="0" />
      </EdgeSize>
    </Backdrop>
  </Frame>
<Frame name="GrimUIcoreArtTarget" parent="DUF_TargetFrame" frameStrata="BACKGROUND" frameLevel="4">
    <!--<FrameSkin skinid="f15d4970-d66d-444e-bb2d-1ad102c87fed" frameid="f15d4971-d66d-444e-bb2d-1ad102c87fed" />-->
    <Size>
      <AbsDimension x="207" y="210" />
    </Size>
    <Anchors>
      <Anchor point="BOTTOM" relativeTo="UIParent">
        <Offset>
          <AbsDimension x="0" y="118" />
        </Offset>
      </Anchor>
    </Anchors>
    <Backdrop bgFile="interface\AddOns\GrimUIcore\Art\FloatingCave">
      <BackgroundInsets>
        <AbsInset left="0" right="0" top="0" bottom="0" />
      </BackgroundInsets>
      <TileSize>
        <AbsValue val="0" />
      </TileSize>
      <EdgeSize>
        <AbsValue val="0" />
      </EdgeSize>
    </Backdrop>
        <Frames>
      <Button name="$InspectButton" frameStrata="HIGH" hidden="true">
        <!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508884-59c2-4f83-ae10-27aaad48391b" />-->
        <Size>
          <AbsDimension x="14" y="14" />
        </Size>
        <Anchors>
          <Anchor point="CENTER">
            <Offset>
              <AbsDimension x="-51" y="-16" />
            </Offset>
          </Anchor>
        </Anchors>
        <Scripts>
          <OnLoad>self:RegisterEvent("PLAYER_TARGET_CHANGED")
self:Hide()</OnLoad>
          <OnEvent>if UnitIsPlayer("target") == nil then
  self:Hide()
else
  self:Show()
end</OnEvent>
          <OnClick>InspectUnit("target")</OnClick>
		  <OnEnter>GameTooltip:SetOwner(this, "ANCHOR_LEFT")
GameTooltip:AddLine("Inspect")
GameTooltip:Show()
</OnEnter>
<OnLeave>GameTooltip:Hide()</OnLeave>
        </Scripts>
        <NormalTexture file="Interface\AddOns\GrimUIcore\Icons\InspectIcon">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </NormalTexture>
        <PushedTexture file="Interface\AddOns\GrimUIcore\Icons\InspectIcon">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </PushedTexture>
        <DisabledTexture file="Interface\AddOns\GrimUIcore\Icons\InspectIcon">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </DisabledTexture>
        <HighlightTexture file="Interface\AddOns\GrimUIcore\Icons\InspectIcon" alphaMode="ADD">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </HighlightTexture>
        <ButtonText name="$parentText">
          <FontHeight>
            <AbsValue val="10" />
          </FontHeight>
        </ButtonText>
        <NormalFont style="GameFontNormal" />
        <HighlightFont style="GameFontHighlight" />
        <DisabledFont style="GameFontDisable" />
      </Button>
    <Button name="$TradeButton" frameStrata="HIGH" hidden="true">
        <!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508884-59c2-4f83-ae10-27aaad48391b" />-->
        <Size>
          <AbsDimension x="15" y="15" />
        </Size>
        <Anchors>
          <Anchor point="CENTER">
            <Offset>
              <AbsDimension x="51" y="-46" />
            </Offset>
          </Anchor>
        </Anchors>
        <Scripts>
          <OnLoad>self:RegisterEvent("PLAYER_TARGET_CHANGED")
self:Hide()</OnLoad>
          <OnEvent>if UnitIsFriend("player","target") and UnitIsPlayer("target") then
self:Show()
else
self:Hide()
end</OnEvent>
          <OnClick>InitiateTrade("target")</OnClick>
		  <OnEnter>GameTooltip:SetOwner(this, "ANCHOR_RIGHT")
GameTooltip:AddLine("Trade")
GameTooltip:Show()
</OnEnter>
<OnLeave>GameTooltip:Hide()</OnLeave>
        </Scripts>
        <NormalTexture file="Interface\AddOns\GrimUIcore\Icons\TradeIcon">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </NormalTexture>
        <PushedTexture file="Interface\AddOns\GrimUIcore\Icons\TradeIcon">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </PushedTexture>
        <DisabledTexture file="Interface\AddOns\GrimUIcore\Icons\TradeIcon">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </DisabledTexture>
        <HighlightTexture file="Interface\AddOns\GrimUIcore\Icons\TradeIcon" alphaMode="ADD">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </HighlightTexture>
        <ButtonText name="$parentText">
          <FontHeight>
            <AbsValue val="10" />
          </FontHeight>
        </ButtonText>
        <NormalFont style="GameFontNormal" />
        <HighlightFont style="GameFontHighlight" />
        <DisabledFont style="GameFontDisable" />
      </Button>
    <Button name="$FollowButton" frameStrata="HIGH" hidden="true">
        <!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508884-59c2-4f83-ae10-27aaad48391b" />-->
        <Size>
          <AbsDimension x="15" y="15" />
        </Size>
        <Anchors>
          <Anchor point="CENTER">
            <Offset>
              <AbsDimension x="-52" y="-47" />
            </Offset>
          </Anchor>
        </Anchors>
        <Scripts>
          <OnLoad>self:RegisterEvent("PLAYER_TARGET_CHANGED")
self:Hide()</OnLoad>
          <OnEvent>if UnitIsFriend("player","target") and UnitIsPlayer("target") then
self:Show()
else
self:Hide()
end</OnEvent>
          <OnClick>FollowUnit("target")</OnClick>
		  <OnEnter>GameTooltip:SetOwner(this, "ANCHOR_LEFT")
GameTooltip:AddLine("Follow")
GameTooltip:Show()
</OnEnter>
<OnLeave>GameTooltip:Hide()</OnLeave>
        </Scripts>
        <NormalTexture file="Interface\AddOns\GrimUIcore\Icons\FollowIcon">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </NormalTexture>
        <PushedTexture file="Interface\AddOns\GrimUIcore\Icons\FollowIcon">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </PushedTexture>
        <DisabledTexture file="Interface\AddOns\GrimUIcore\Icons\FollowIcon">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </DisabledTexture>
        <HighlightTexture file="Interface\AddOns\GrimUIcore\Icons\FollowIcon" alphaMode="ADD">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </HighlightTexture>
        <ButtonText name="$parentText">
          <FontHeight>
            <AbsValue val="10" />
          </FontHeight>
        </ButtonText>
        <NormalFont style="GameFontNormal" />
        <HighlightFont style="GameFontHighlight" />
        <DisabledFont style="GameFontDisable" />
      </Button>
      <Button name="$WhisperButton" frameStrata="HIGH" hidden="true">
        <!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508884-59c2-4f83-ae10-27aaad48391b" />-->
        <Size>
          <AbsDimension x="15" y="15" />
        </Size>
        <Anchors>
          <Anchor point="CENTER">
            <Offset>
              <AbsDimension x="-52" y="-31" />
            </Offset>
          </Anchor>
        </Anchors>
        <Scripts>
          <OnLoad>self:RegisterEvent("PLAYER_TARGET_CHANGED")
self:Hide()</OnLoad>
          <OnEvent>if UnitIsFriend("player","target") and UnitIsPlayer("target") then
self:Show()
else
self:Hide()
end</OnEvent>
          <OnClick>local name, realm = UnitName("target");
if(realm) then
   ChatFrame_SendTell(name.."-"..realm);
else
   ChatFrame_SendTell(name)
 end</OnClick>
 <OnEnter>GameTooltip:SetOwner(this, "ANCHOR_LEFT")
GameTooltip:AddLine("Whisper")
GameTooltip:Show()
</OnEnter>
<OnLeave>GameTooltip:Hide()</OnLeave>
        </Scripts>
        <NormalTexture file="Interface\AddOns\GrimUIcore\Icons\WhisperIcon">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </NormalTexture>
        <PushedTexture file="Interface\AddOns\GrimUIcore\Icons\WhisperIcon">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </PushedTexture>
        <DisabledTexture file="Interface\AddOns\GrimUIcore\Icons\WhisperIcon">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </DisabledTexture>
        <HighlightTexture file="Interface\AddOns\GrimUIcore\Icons\WhisperIcon" alphaMode="ADD">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </HighlightTexture>
        <ButtonText name="$parentText">
          <FontHeight>
            <AbsValue val="10" />
          </FontHeight>
        </ButtonText>
        <NormalFont style="GameFontNormal" />
        <HighlightFont style="GameFontHighlight" />
        <DisabledFont style="GameFontDisable" />
      </Button>
            <Button name="$InviteButton" frameStrata="HIGH" hidden="true">
        <!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508884-59c2-4f83-ae10-27aaad48391b" />-->
        <Size>
          <AbsDimension x="15" y="15" />
        </Size>
        <Anchors>
          <Anchor point="CENTER">
            <Offset>
              <AbsDimension x="51" y="-27" />
            </Offset>
          </Anchor>
        </Anchors>
        <Scripts>
		<OnLoad>self:RegisterEvent("PLAYER_TARGET_CHANGED") self:RegisterEvent("PARTY_MEMBERS_CHANGED")
self:Hide()</OnLoad>
          <OnEvent>if UnitIsFriend("player","target") and UnitIsPlayer("target") and not UnitInParty("target") then
self:Show()
else
self:Hide()
end</OnEvent>
<OnEnter>GameTooltip:SetOwner(this, "ANCHOR_RIGHT")
GameTooltip:AddLine("Invite")
GameTooltip:Show()
</OnEnter>
<OnLeave>GameTooltip:Hide()</OnLeave>
        <OnClick>local name = UnitName("target");
        InviteUnit(name)</OnClick>
        </Scripts>
        <NormalTexture file="Interface\AddOns\GrimUIcore\Icons\InviteIcon">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </NormalTexture>
        <PushedTexture file="Interface\AddOns\GrimUIcore\Icons\InviteIcon">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </PushedTexture>
        <DisabledTexture file="Interface\AddOns\GrimUIcore\Icons\InviteIcon">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </DisabledTexture>
        <HighlightTexture file="Interface\AddOns\GrimUIcore\Icons\InviteIcon" alphaMode="ADD">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </HighlightTexture>
        <ButtonText name="$parentText">
          <FontHeight>
            <AbsValue val="10" />
          </FontHeight>
        </ButtonText>
        <NormalFont style="GameFontNormal" />
        <HighlightFont style="GameFontHighlight" />
        <DisabledFont style="GameFontDisable" />
      </Button>
        <Button name="$GTipNotesButton" frameStrata="HIGH" hidden="true">
        <!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508884-59c2-4f83-ae10-27aaad48391b" />-->
        <Size>
          <AbsDimension x="13" y="13" />
        </Size>
        <Anchors>
          <Anchor point="CENTER">
            <Offset>
              <AbsDimension x="-50" y="1" />
            </Offset>
          </Anchor>
        </Anchors>
        <Scripts>
          <OnLoad>self:RegisterEvent("PLAYER_TARGET_CHANGED")
self:Show()</OnLoad>
        <OnClick>local _G = _G
local function RunSlashCmd(cmd)
  local slash, rest = cmd:match("^(%S+)%s*(.-)$")
  for name in pairs(SlashCmdList) do
     local i = 1
     local slashCmd
     repeat
        slashCmd = _G["SLASH_"..name..i]
        
        if slashCmd == slash then
           -- Call the handler
           SlashCmdList[name](rest)
           return true
        end
        i = i + 1
     until not slashCmd
  end
end 
RunSlashCmd("/gtipnotes")</OnClick>
<OnEnter>GameTooltip:SetOwner(this, "ANCHOR_LEFT")
GameTooltip:AddLine("Add Note")
GameTooltip:Show()
</OnEnter>
<OnLeave>GameTooltip:Hide()</OnLeave>
        </Scripts>
        <NormalTexture file="Interface\AddOns\GrimUIcore\Icons\GTipNotesIcon">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </NormalTexture>
        <PushedTexture file="Interface\AddOns\GrimUIcore\Icons\GTipNotesIcon">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </PushedTexture>
        <DisabledTexture file="Interface\AddOns\GrimUIcore\Icons\GTipNotesIcon">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </DisabledTexture>
        <HighlightTexture file="Interface\AddOns\GrimUIcore\Icons\GTipNotesIcon" alphaMode="ADD">
          <TexCoords left="0" right="1" top="0" bottom="1" />
        </HighlightTexture>
        <ButtonText name="$parentText">
          <FontHeight>
            <AbsValue val="10" />
          </FontHeight>
        </ButtonText>
        <NormalFont style="GameFontNormal" />
        <HighlightFont style="GameFontHighlight" />
        <DisabledFont style="GameFontDisable" />
      </Button>
    </Frames>
  </Frame>
<Frame name="GrimUIcoreArtAggroL" alpha="0.50" frameStrata="LOW" frameLevel="2">
    <!--<FrameSkin skinid="f15d4970-d66d-444e-bb2d-1ad102c87fed" frameid="f15d4971-d66d-444e-bb2d-1ad102c87fed" />-->
    <Size>
      <AbsDimension x="63" y="65" />
    </Size>
    <Anchors>
      <Anchor point="BOTTOM" relativeTo="UIParent">
        <Offset>
          <AbsDimension x="-347" y="14" />
        </Offset>
      </Anchor>
    </Anchors>
    <Backdrop bgFile="interface\AddOns\GrimUIcore\Art\Aggro">
      <BackgroundInsets>
        <AbsInset left="0" right="0" top="0" bottom="0" />
      </BackgroundInsets>
      <TileSize>
        <AbsValue val="0" />
      </TileSize>
      <EdgeSize>
        <AbsValue val="0" />
      </EdgeSize>
    </Backdrop>
    <Scripts>
      <OnLoad>self:RegisterEvent("PLAYER_REGEN_DISABLED")
self:RegisterEvent("PLAYER_REGEN_ENABLED")
self:Hide()</OnLoad>
      <OnEvent>if event == "PLAYER_REGEN_ENABLED" then
self:Hide()
elseif event == "PLAYER_REGEN_DISABLED" then
self:Show()
end</OnEvent>
    </Scripts>
  </Frame>
  <Frame name="GrimUIcoreArtAggroR" alpha="0.50" frameStrata="LOW" frameLevel="2">
    <!--<FrameSkin skinid="f15d4970-d66d-444e-bb2d-1ad102c87fed" frameid="f15d4971-d66d-444e-bb2d-1ad102c87fed" />-->
    <Size>
      <AbsDimension x="66" y="65" />
    </Size>
    <Anchors>
      <Anchor point="BOTTOM" relativeTo="UIParent">
        <Offset>
          <AbsDimension x="344" y="14" />
        </Offset>
      </Anchor>
    </Anchors>
    <Backdrop bgFile="interface\AddOns\GrimUIcore\Art\Aggro">
      <BackgroundInsets>
        <AbsInset left="0" right="0" top="0" bottom="0" />
      </BackgroundInsets>
      <TileSize>
        <AbsValue val="0" />
      </TileSize>
      <EdgeSize>
        <AbsValue val="0" />
      </EdgeSize>
    </Backdrop>
    <Scripts>
      <OnLoad>self:RegisterEvent("PLAYER_REGEN_DISABLED")
self:RegisterEvent("PLAYER_REGEN_ENABLED")
self:Hide()</OnLoad>
      <OnEvent>if event == "PLAYER_REGEN_ENABLED" then
self:Hide()
elseif event == "PLAYER_REGEN_DISABLED" then
self:Show()
end</OnEvent>
    </Scripts>
  </Frame>
</Ui>
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
08-26-09, 12:52 PM   #13
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
/me shudders at xml code

perhaps the problem is that you have 6 frames all registering for PLAYER_TARGET_CHANGED? And two for PLAYER_REGEN_ENABLED/DISABLED, too.

Then again, I never use xml, so I'm not sure if that would cause your memory leak...
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
08-26-09, 12:59 PM   #14
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
know of a way to consolidate them? or if you know how to make it all lua i would love you forever
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
08-26-09, 02:12 PM   #15
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 199
/me shudders at xml code too, needs love and got too much time

http://pastey.net/123436

Your ~500 lines of XML compressed in ~250 lines of Lua, commented.
Different event blocks are mostly merged. As usual, I didn't test it and so there are probably lots of syntax errors ...

But the principle in "XML-Lua" would basically be the same: Register only one frame for the event and then run through all buttons in this single function - since you can access them via their global name, it shouldn't be to difficult.

But I didn't find any reason for your memory leaks, especially since multiple frames registered to one event shouldn't cause any problems and your event-/tooltip-code is not executed on login/reload.

P.S.: Just noticed that my text with "this" instead of "self" was wrong: Even in XML, Blizz switched to "self" lots of patches ago, so "this" is basically deprecated.
__________________
« Website | GitHub »

Oh hai!
  Reply With Quote
08-26-09, 03:10 PM   #16
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
im going over that it looks like it should work also looks easier to understand the way you did it. ever think about being a teacher? lol. good tips. i do notice a few things though... how does it call to the dif icons for the buttons? i dont see anywhere that it points to icon files.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
08-26-09, 03:20 PM   #17
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 199
The normal art frames get their backdrop in the entry "bgFile" of a table which is then passed to :SetBackdrop() - you can see it in line 13, for example.

The texture of the target-buttons is assigned in line 96. It's only one line, because you made it easy and named the buttons exactly like their icon-texture, so we can just use their name in the path.
I've removed your PushedTexture, HighlightTexture and DisabledTexture, because they were the same as the original one, so it shouldn't make a visible difference. But of course you could add them via SetPushedTexture() and so on.
__________________
« Website | GitHub »

Oh hai!
  Reply With Quote
08-26-09, 03:28 PM   #18
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
hmm interesting. it did highlight. i just tried the code a few issues. it does not appear to hook to the duf target frame properly for some reason. dont see the target buttons and the aggro graphic is always on lol. only 3 errors not bad. btw it uses less mem and cpu even with the errors lol
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
08-26-09, 03:31 PM   #19
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 199
3 errors are 3 too much Could you post them please?
They could well be the reason why the frames are placed that strange.
__________________
« Website | GitHub »

Oh hai!
  Reply With Quote
08-26-09, 07:58 PM   #20
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
this is the first error. might actually be the only one but it is stopping everything.

GrimUIcore-3.2.1\GrimUICoreArt.lua:185: Usage: UnitIsFriend("unit", "otherUnit")
GrimUIcore-3.2.1\GrimUICoreArt.lua:185: in function <Interface\AddOns\GrimUIcore\GrimUICoreArt.lua:182>
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Tooltips and XML


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