WoW:Creating simple pop-up dialog boxes (source)
Revision as of 03:54, 24 April 2008
, 24 April 2008→Optional Features: Lua is not an acronym.
mNo edit summary |
m (→Optional Features: Lua is not an acronym.) |
||
| Line 95: | Line 95: | ||
* ''sound'' - Play this sound when the dialog is displayed. For example, "igPlayerInvite". | * ''sound'' - Play this sound when the dialog is displayed. For example, "igPlayerInvite". | ||
* ''hasMoneyFrame'' - This is for things like the money-in-mail confirmation. See the | * ''hasMoneyFrame'' - This is for things like the money-in-mail confirmation. See the Lua file for more. | ||
* ''showAlert'' - Set this to 1 if you also want the OH NO SOMETHING BAD icon to be displayed in the popup. For example, deleting a mail message with an item still attached to it. | * ''showAlert'' - Set this to 1 if you also want the OH NO SOMETHING BAD icon to be displayed in the popup. For example, deleting a mail message with an item still attached to it. | ||
* ''notClosableByLogout'' - Normally if a player quits the game, your popup will go away and its OnCancel function will be called. Set this field to 1 to avoid that behavior. | * ''notClosableByLogout'' - Normally if a player quits the game, your popup will go away and its OnCancel function will be called. Set this field to 1 to avoid that behavior. | ||
| Line 155: | Line 155: | ||
== Notes and Observations == | == Notes and Observations == | ||
* The 'text' fields and button1/2 fields are usually localized. Blizzard tends to use generic texts like ACCEPT, CANCEL, and OKAY; you can probably do the same. | * The 'text' fields and button1/2 fields are usually localized. Blizzard tends to use generic texts like ACCEPT, CANCEL, and OKAY; you can probably do the same. These global variables contain a localized string and can be used as-is, like <tt>button1 = ACCEPT</tt> | ||
* Creating a static popup with an editbox and only one button will cause the button and the editbox to overlap. Having more than one button will get the desired behavior. (Tested on 2.4.1) | |||
* 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]] | ||