Reply
 
Thread Tools Display Modes
Old 03-09-13, 04:02 PM   #1
Spawnova
A Black Drake
 
Spawnova's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2012
Posts: 87
Frame highlight mouseover

What's the correct/best way to create a highlight effect when mousing over a frame?
Spawnova is online now   Reply With Quote
Old 03-09-13, 04:19 PM   #2
semlar
A Firelord
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 458
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.
semlar is offline   Reply With Quote
Old 03-09-13, 05:08 PM   #3
Spawnova
A Black Drake
 
Spawnova's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2012
Posts: 87
Works perfect thank you!
Spawnova is online now   Reply With Quote
Old 03-09-13, 05:36 PM   #4
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 3,951
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!")
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Reply

Go BackWoWInterface » 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