• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Why my custom tooltip is not displaying correctly?

Level 24
Joined
Jun 26, 2020
Messages
1,852
Hello, I made this custom tooltip using the method the set the height of the text frame to 0 to auto-set according to the text and then setting the backdrop a bit bigger than the text:
Lua:
local lockFrame = BlzCreateFrameByType("BACKDROP", "BackdropLockCosmeticEffect[" .. id .. "]", button, "", 0)
BlzFrameSetAllPoints(backdrop, button)
BlzFrameSetTexture(backdrop, "ReplaceableTextures\\CommandButtons\\BTNLock.blp", 0, true)
BlzFrameSetLevel(lockFrame, 2)

local tooltip = BlzCreateFrame("CheckListBox", lockFrame, 0, 0)

local tooltipText = BlzCreateFrameByType("TEXT", "name", tooltip, "", 0)
BlzFrameSetPoint(tooltipText, FRAMEPOINT_BOTTOMLEFT, lockFrame, FRAMEPOINT_CENTER, 0.0000, 0.0000)
BlzFrameSetEnable(tooltipText, false)
BlzFrameSetScale(tooltipText, 1.00)
BlzFrameSetTextAlignment(tooltipText, TEXT_JUSTIFY_TOP, TEXT_JUSTIFY_LEFT)

BlzFrameSetText(tooltipText, unlockDesc)
BlzFrameSetSize(tooltipText, 0.15, 0)
BlzFrameSetPoint(tooltip, FRAMEPOINT_TOPLEFT, tooltipText, FRAMEPOINT_TOPLEFT, -0.015000, 0.015000)
BlzFrameSetPoint(tooltip, FRAMEPOINT_BOTTOMRIGHT, tooltipText, FRAMEPOINT_BOTTOMRIGHT, 0.015000, -0.015000)
But for some reason the tooltip frame appears as having 0 size:

1697421923399.png


I don't know what is happening, I used this exact method several times and this is the first time its happening this issue, I even tried setting the size of the backdrop manually with the BlzFrameSetSize, but still, what's wrong?
 
Level 24
Joined
Jun 26, 2020
Messages
1,852
My bad, the problem is in the first paragraph of the code, I was using the wrong variable :xxd:

Now the tooltip has the right dimensions, but is not appearing when I pass the cursor above the lock frames (the tooltip named tooltip is for the frame named lockFrame), why?
 
Last edited:
Level 24
Joined
Jun 26, 2020
Messages
1,852
Because you need to use BlzFrameSetTooltip(lockFrame, tooltip), which appears to have been forgotten :p
I'm actually doing that, I just didn't show the entire script, because the original problem was another, right after the previous script I did this:
Lua:
BlzFrameSetTooltip(lockFrame, tooltip)

BlzFrameSetEnable(button, false)
I'm including that last line because I think that it was the reason why it was happening (button is parent of the lockFrame), but not sure, because I changed the parent, but the tooltip still doesn't appear when I'm hovering the lockFrame with the pointer.
 
Top