WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Frame highlight mouseover (https://www.wowinterface.com/forums/showthread.php?t=46017)

Spawnova 03-09-13 05:02 PM

Frame highlight mouseover
 
What's the correct/best way to create a highlight effect when mousing over a frame?

semlar 03-09-13 05:19 PM

If you don't mind making the frame intercept mouse clicks then you can do it like
Lua Code:
  1. frame:EnableMouse()
  2. frame:SetScript('OnEnter', function() highlightStuff end)
  3. frame:SetScript('OnLeave', function() unHighightStuff end)
Otherwise you can check frame:IsMouseOver() OnUpdate.

I think buttons have highlight scripts set up by default.

Spawnova 03-09-13 06:08 PM

Works perfect thank you!

Phanx 03-09-13 06:36 PM

If you just want to show textures and/or font strings on mouseover (like the highlight texture on buttons in default UI) you don't need to use scripts; you can just put them on the "HIGHLIGHT" layer:

Code:

-- A transparent yellow texture will appear on mouseover:
local highlightTexture = frame:CreateTexture(nil, "HIGHLIGHT")
highlightTexture:SetAllPoints(true)
highlightTexture:SetTexture(1, 1, 0, 0.5)

-- The word "Mouse!" will appear on mouseover:
local highlightFontString = frame:CreateFontString(nil, "HIGHLIGHT", "GameFontNormalLarge")
highlightFontString:SetPoint("CENTER")
highlightFontString:SetText("Mouse!")



All times are GMT -6. The time now is 06:27 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI