OnLeave & Frame
Hi,
I was rewriting one of my addons trying to implement a custom frame instead of the standard LDB. Everything works just fine but I was wondering if it is possible to use an onLeave codition to close it. The skeleton code is something like this (shorter than the full code): Lua Code:
I thought a simple: Lua Code:
was ok to hide the frame when not hovering on it, but I was wrong :) So now I ask: Is there a simple way to accomplish this and prevent the fact the frame remains open until someone clicks the bar again ? Thanks very much for your input. P.s. Actually the Tooltip is this: |
Menu:SetScript('OnLeave', Menu.Hide)
|
Quote:
You're setting the frame handler to be the :Hide() metamethod. As this isn't a function call, just passing a function pointer, it loses the internal self argument. Frames just happen to push themselves as the first argument to their handlers, so everything works out anyway. |
Hi,
thanks really so much for the reply and explanation on the differences from : and . I have tried to implement your suggestion but I have a problem ... Since I left click in the Data Broker to make the menu appears and it works until I hover the frame but when I touch the buttons it breaks :/ Probably the buttons are not checked as whole frame ? Here is a gif (in loop) showing the thing: http://s23.postimg.org/bw238gnjv/test_menu.gif Surely is a problem of my code because I am really not so skilled in the frame management. I post the full thing: Lua Code:
Thanks all. |
From what I can tell, Menu is firing OnLeave you mouseover the spec buttons. You might want to have a custom handler check for that before hiding itself. You're also recreating them at every loading screen instead of just at login. You should either unregister PLAYER_ENTERING_WORLD when done or use PLAYER_LOGIN instead.
|
Quote:
About the second part of the problems I have changed in this way (I realized that it should be broken because sometime the buttons fonts were mangled). I used a mix of your tips using event "PLAYER_LOGIN" and then unregister once fired. Lua Code:
Quote:
This works but is so ugly ? Lua Code:
The problem is when I hovering the buttons the "name" var is something like: table:00000149a7cf46e0 or if I exit from the frame values I get are: WorldFrame ChocolateBar1 etc etc ... Thanks anyway for your suggestions. |
Here is a modified version of your code with the OnLeave script fixed. I also changed it to behave and look more like other LDB plugins I've seen.
Code:
local ADDON = ... |
Thanks Vrul,
your code is awesome and work like a charm :) I am studying it :) Thanks again. It is much appreciated. |
All times are GMT -6. The time now is 12:15 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI