WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   How to add click event to a frame (https://www.wowinterface.com/forums/showthread.php?t=48889)

Spawnova 01-30-14 06:57 AM

How to add click event to a frame
 
I want to be able to add events to my frame when I left and right click but frames cannot have click events.

So I was wondering if there was a workaround, like an invisible button or something?

Malsomnus 01-30-14 07:31 AM

Frames might not have click events, but they have MouseDown and MouseUp, which also let you know which button was pressed.

Lua Code:
  1. MyFrame:SetScript("OnMouseDown", function (self, button)
  2.     if button=='LeftButton' then
  3.         print ('OMG left button?!')
  4.     end
  5. end)

Spawnova 01-30-14 08:41 AM

Thanks man, appreciate it.

Phanx 01-30-14 01:02 PM

Your other option would be to make your frame a Button object instead of a Frame object; it won't look any different (unless you also have it inherit from some kind of button template) and users won't be able to tell the difference, but it will support an actual OnClick script. This will only matter if what you want to do on "click" requires a hardware event -- if it does, then you need OnClick; you can't do that stuff in OnMouseDown/OnMouseUp.

Spawnova 01-31-14 02:33 AM

Thanks phanx, for now the SetScript works perfectly however I'm definitely going to use yours for some others addons I have, thanks.

Also, this is somewhat off topic but does anyone know of an addon or someway to see the resources currently running addons are using?

Duugu 01-31-14 03:40 AM

http://www.wowinterface.com/download...ddonUsage.html

Seerah 01-31-14 10:15 AM

I use this one:http://www.wowinterface.com/download...tionHouse.html

It may be in the outdated category, but it still works perfectly.

pelf 02-02-14 02:12 AM

The event CPU usage tracking portion of the performance monitoring API is broken, FYI. The rest of it is working, though, I think.


All times are GMT -6. The time now is 10:28 AM.

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