Thread Tools Display Modes
03-09-13, 05:02 PM   #1
Spawnova
A Warpwood Thunder Caller
 
Spawnova's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2012
Posts: 96
Frame highlight mouseover

What's the correct/best way to create a highlight effect when mousing over a frame?
  Reply With Quote
03-09-13, 05:19 PM   #2
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
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.
  Reply With Quote
03-09-13, 06:08 PM   #3
Spawnova
A Warpwood Thunder Caller
 
Spawnova's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2012
Posts: 96
Works perfect thank you!
  Reply With Quote
03-09-13, 06:36 PM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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!")
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Frame highlight mouseover

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