Chapter 15: Page 299 - 'Modifying an Existing Frame'
The code example in this section doesn't quite work as advertised due to attributes that are already set on the TargetFrame frame. In particular, the *type1
and *type2
attributes are set so you can target the unit with any left-click and open the unit menu with any right-click. When resolving a wildcard attribute, priority is given to the modifiers and then to the buttons, so when you set the attributes listed in this block, the shift-type-*
attribute and friends are never found when left or right-clicking.
You can fix this block by adding the following four lines to the top of the code:
/run TargetFrame:SetAttribute("*type1", nil)
/run TargetFrame:SetAttribute("*type2", nil)
/run TargetFrame:SetAttribute("type1", "target")
/run TargetFrame:SetAttribute("type1", "menu")
This change the behaviour of the frame so that shift-left-clicking will no longer target the unit, but will cast the Linen Bandage on the unit, etc.