Skip to content
everloot

Lore archive · Warcraft Wiki, 2023 dump

SecureUnitButtonTemplate

Last wiki revision 2010-09-10

SecureUnitButtonTemplate is one of the SecureTemplates introduced in Patch 2.0. It's purpose is to allow creation of unit frames, executing certain protected actions from secure code in response to clicks.

This template's behavior differs only slightly from SecureActionButtonTemplate, and can be thought of as a special case. The only difference is in how the menu function is handled: the template allows spells currently being targeted to be cancelled before calling the menu function.

FrameXML defines a convenience method to interact with this template: SecureUnitButton_OnLoad(self, unit, menufunc) The function sets a limited number of attributes on a frame to make it behave like the default unit frames: left clicks target the unit, and right clicks open the menu by calling menuFunc(self, unit, button).

  • self : Frame - frame inheriting from SecureUnitButtonTemplate.
  • unit : String - unit this unit frame is showing/acting on.
  • menuFunc : Function - menu function to show when the frame is right clicked.

Another useful function is (frame), which controls the visibility of a protected frame based on whether the unit specified by the frame's "unit" attribute exists.

The template supports all of the attributes supported by SecureActionButtonTemplate, and behaves in similar fashion. There is a single special case: if the value of the modified attribute "type" is "menu" (with no unit remapping performed), the OnClick cancels any spell being targeted and calls menuFunc.

Some attributes may be used to enable automatic vehicle unit remapping for the frame: making the player frame behave as a vehicle frame, and a pet frame behave as a player frame when the player is in a vehicle.

Source

https://warcraft.wiki.gg/wiki/SecureUnitButtonTemplate · retrieved 2023-11-13 · CC BY-SA 4.0

Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.

This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.