Clicking frame targets player
Hi, I am working on a new unit frame mostly just to learn the addons api. I got alot of stuff working but on of the features of the default ui i can't seem to figure out is how when you click it you end up selecting your own character..
From what i see this is a protected function but lots of other addons are able to do it so there must be a way. there is also another feature which is when you hold over a unit frame (group, player or target) they will also be "selected" for the time you hover this is used by hover macros and some addons like clique. My Addon source: LUA: https://pastebin.com/m6CVhNdQ XML: https://pastebin.com/BsA9qXFk |
Blizzard includes secure templates you can inherit from that offer access to protected functionality. Here's a list of resources to check out.
See also: |
Quote:
|
I tried adding inherits="SecureHandlerMouseUpDownTemplate" on my PlayerFrame and adding this code to it
Code:
|
Try using SecureUnitButtonTemplate. Your frame needs to be of type Button like this.
Code:
<Button name="SUF_PlayerFrame" parent="UIParent" inherits="SecureUnitButtonTemplate" movable="true"> In your OnLoad script, you need to add these. (Note: You should pass self to your OnLoad handler and use that.) Code:
self:RegisterForClicks("AnyUp"); |
Quote:
|
All times are GMT -6. The time now is 06:07 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI