WoW:Creating simple pop-up dialog boxes: Difference between revisions

edited the example of passing arguments to local functions for clarification
mNo edit summary
(edited the example of passing arguments to local functions for clarification)
Line 146: Line 146:
Write your local function like this:
Write your local function like this:


     OnAccept = function(argName)
     OnAccept = function(self)
                   DoSomethingWith(argName)
                   DoSomethingWith(self.data)
               end
               end


Line 167: Line 167:
* While creating your popup entries, you will probably be doing a lot of UI reloading.  Extract the <tt>[[FrameXML/DebugUI.xml]]</tt> file from the default UI, copy it into your addon folder, and add it to your .toc file.  This has two effects:  it starts verbose logging into FrameXML.log, and it adds a "Reload UI" button to your screen.  Very handy timesaver.  :-)
* While creating your popup entries, you will probably be doing a lot of UI reloading.  Extract the <tt>[[FrameXML/DebugUI.xml]]</tt> file from the default UI, copy it into your addon folder, and add it to your .toc file.  This has two effects:  it starts verbose logging into FrameXML.log, and it adds a "Reload UI" button to your screen.  Very handy timesaver.  :-)
* Added by [[user:Layrajha|Layrajha]]: The OnHide function will always be called after OnAccept or OnCancel have finished their execution. Therefore, it is safe to assume that your changes done in OnAccept or OnCancel will be done when OnHide is called. Also note that you can prevent the popup from hiding after clicking the "Accept" button: just make the OnAccept function return "true" (or anything different from "nil" and "false", it will work just as well).
* Added by [[user:Layrajha|Layrajha]]: The OnHide function will always be called after OnAccept or OnCancel have finished their execution. Therefore, it is safe to assume that your changes done in OnAccept or OnCancel will be done when OnHide is called. Also note that you can prevent the popup from hiding after clicking the "Accept" button: just make the OnAccept function return "true" (or anything different from "nil" and "false", it will work just as well).
[[Category: HOWTOs|Popup Simple Dialog Boxes]]
[[Category: HOWTOs|Popup Simple Dialog Boxes]]
Anonymous user