![]() |
Quote:
(<ID of Event handler registation>, <Event>, <Callback>). Maybe RegsiterCallback returns some value (like an int index). Does anybody know how one could unregister a callback from a Callback Manager? Anything RegisterCallback Returns? Maybe you just give the callback again during unregister? |
Quote:
They do not know what we write in our OnUIUpdate Event Handlers. And still our Handlers are able to react to the event (specificalyl the Update/Draw phase of the UI). A second aspect is that Events do not need to follow the usual rules for declaration. You can "Fire" an event in code, long before you have any Callback defined (much less registerd). With normal function calls you need to have the code you call defined before you call it*. Also you can register an arbitrary amount of different Callback functions to one Event. *Wich can get you into a Egg and Chicken Paradox if A depends on B, B on C and C on A. And yes, I managed to programm myself into one of those. |
Quote:
Lua Code:
Quote:
Lua Code:
|
I rewrote the wiki explanation for Custom events. Based on the parts I did not understand properly when trying to learn it. I hope it is now easier to understand and use.
http://wiki.esoui.com/AddOn_Quick_Qu...s.22_in_Lua.3F Also, regarding wanting an example. Here is a small lib I wrote (in part to learn Event Programming). On every UI update it checks if the Camera Heading has been changed (wich can be important to identify what target is under the cursor). First I set up a dummy UI Element to intercept the UIUpdate Event. This was copied from exterminatus group Leader. There is no other way (like an Event Manager event) to get notified of a new Frame. Code:
<GuiXml> Code:
--Background variable to store the last heading the Event was raised against Code:
--Set up handler for Custom event |
Quote:
|
Quote:
Propably need to delve into Metatables and simualted classes next before being totally there, but I can cobble something together right now. Propably will post it over in the getset-pattern thread however. |
Quote:
|
All times are GMT -6. The time now is 04:16 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI