1. I am very pleased with this book and am working on an addon that utilizes the functionality of the BasicUnitFrames addon & the SABTest addon. What code could I insert so that, when I clicked a person's button it would cast a certain spell on their target?

    Thanks, & once again great work with the book.

    Taken from SecureTemplates.lua:

     -- SecureActionButton
     -- SecureActionButtons allow you to map different combinations of modifiers and buttons into
     -- actions which are executed when the button is clicked.
     -- For example, you could set up the button to respond to left clicks by targeting the focus:
     -- self:SetAttribute("unit", "focus");
     -- self:SetAttribute("type1", "target");
     -- You could set up all other buttons to bring up a menu like this:
     -- self:SetAttribute("type*", "menu");
     -- self.showmenu = menufunc;
     -- SecureActionButtons are also able to perform different actions depending on whether you can
     -- attack the unit or assist the unit associated with the action button.  It does so by mapping
     -- mouse buttons into "virtual buttons" based on the state of the unit. For example, you can use
     -- the following to cast "Mind Blast" on a left click and "Shadow Word: Death" on a right click
     -- if the unit can be attacked:
     -- self:SetAttribute("harmbutton1", "nuke1");
     -- self:SetAttribute("type-nuke1", "spell");
     -- self:SetAttribute("spell-nuke1", "Mind Blast");
     -- self:SetAttribute("harmbutton2", "nuke2");
     -- self:SetAttribute("type-nuke2", "spell");
     -- self:SetAttribute("spell-nuke2", "Shadow Word: Death");
     -- In this example, we use the special attribute "harmbutton" which is used to map a virtual
     -- button when the unit is attackable. We also have the attribute "helpbutton" which is used
     -- when the unit can be assisted.
     -- Although it may not be immediately obvious, we are able to use this new virtual button
     -- to set up very complex click behaviors on buttons. For example, we can define a new "heal"
     -- virtual button for all friendly left clicks, and then set the button to cast "Flash Heal"
     -- on an unmodified left click and "Renew" on a ctrl left click:
     -- self:SetAttribute("*helpbutton1", "heal");
     -- self:SetAttribute("*type-heal", "spell");
     -- self:SetAttribute("spell-heal", "Flash Heal");
     -- self:SetAttribute("ctrl-spell-heal", "Renew");
     -- This system is very powerful, and provides a good layer of abstraction for setting up
     -- a button's click behaviors.

    Thanks for the reply. Currently I have self:SetAttribute(type, spell) self:SetAttribute(spell, "spell name") in the OnLoad function. Unfortunately it tries to cast the spell at the party member that the button is associated with (I am using the BasicUnitFrames xml & lua files w/ some minor modifications). This is fine for heals & buffs, but I am trying to cast a spell at the party member's target. So is there another API or something I could insert here to do so??

    Thanks again!

    You must specify the unit.

    frame:SetAttribute("unit", "mouseovertarget")

    Would cast it on the mouseover unit (The unit you are hovering over)'s target.