1. Is there any more direct way to bind a pet command to a header other than:



    button:SetAttribute("_onclick",

    if down then

    print("Down");

    self:SetBinding(true, "MOUSEWHEELUP", "BonusActionButton1")

    self:SetBinding(true, "MOUSEWHEELDOWN", "BonusActionButton3")

    self:SetBinding(true, "BUTTON5", "BonusActionButton2")

    else

    self:ClearBindings()

    end

    );





    What I mean is if there is a way to bind for example the "petfollow" action without binding the ActionButton or with out the use of other SecureButton; something like binding a spell to a key.



    Thanks in Advance.

    Is there any more direct way to bind a pet command to a header other than:



    button:SetAttribute("_onclick",

    if down then

    print("Down");

    self:SetBinding(true, "MOUSEWHEELUP", "BonusActionButton1")

    self:SetBinding(true, "MOUSEWHEELDOWN", "BonusActionButton3")

    self:SetBinding(true, "BUTTON5", "BonusActionButton2")

    else

    self:ClearBindings()

    end

    );





    What I mean is if there is a way to bind for example the "petfollow" action without binding the ActionButton or with out the use of other SecureButton; something like binding a spell to a key.



    Thanks in Advance.

    I'm not sure I totally understand.  You can use the following APIs to bind pet follow in a few different ways:

    SetBindingClick - Set a key binding directly to a Button object, in particular the pet action button

    SetBindingMacro - Assign a keybinding to a specific macro

    I also suspect you could use SetBinding directly using the PETFOLLOW binding, but I am not 100% sure on that.  Could you be more specific about what limitation you are trying to get around?

    Exactly; Something like

    self:SetBinding(true, "BUTTON5", "PETFOLLOW")

    or

    self:SetBindingMacro(true, "BUTTON5", "PETFOLLOW")

     

    But It didn't worked for me; may be I am doing something else wrong.

    I have tested many variations (even before posting in the first place) petfollow, PetFollow, petfollow(), PetFollow(), ... with macro, spell or just SetBinding.

    What is this self:SetBinding() nonsense?  SetBinding is just a global function and does not take a boolean as the first argument.  You can accomplish this using the following:

    Run the following slash command /run SetBindingClick("BUTTON5", "PetActionButton2")

    This binds your fifth mouse button to pet follow.  One command.. no self:SetBinding.. nothign like that.  You can unbind it with /run SetBindingClick("BUTTON5").

    Unfortunately it is not a nonsense; here is the detail:

    As shown in first post the code is inside of a header

    button:SetAttribute("_onclick",

    if down then

    print("Down");

    self:SetBinding(true, "MOUSEWHEELUP", "BonusActionButton1")

    self:SetBinding(true, "MOUSEWHEELDOWN", "BonusActionButton3")

    self:SetBinding(true, "BUTTON5", "BonusActionButton2")

    else

    self:ClearBindings()

    end

    );

    This means that the bindings get asociated with the header so when I self:ClearBindings() I just clear all the asociated ones with the header.



    The "true" is the value of "priority" parameter of the function; you can see it your self in the UI code:

    RestrictedFrames.lua

    function HANDLE:SetBinding(priority, key, action)

        if (action ~= nil and type(action) ~= "string") then

            error("Invalid binding action");

            return;

        end

        SetOverrideBinding(GetHandleFrame(self), priority, key, action);

    end

    Where priority then is called "isPriority" incide the API function SetOverrideBinding.

    At least in my tests I got errors if I omited the parameter.

    I apoligize.. I did not understand that you were trying to do all of this within a header, hence my asking where the syntax and extra param were coming from.  The answer to you question then is no, becuase Blizzard does not have a binding action for comanding the pet to follow you. You could create a macro using the /petfollow command, but using the action buttons is probably the best way right now.

    ^^

    Thou I still wonder... everything has a root there should be a command; something is evoked when you create an secure pet action button you define action slots and they run whatever is incide them;

    I tried to get the information about what was on the action slot corresponding to Pet Attack, Follow, Stay, and Agresive, Defensive, ... with GetCursorInfo() but strangely I get no returns (when I tried it with other spells/actions it works just fine).

    Any Ideas?.

    http://wowprogramming.com/docs/api/PetFollow is the root that does it.  I don't really understand your other question. Why can you not make a macrotext button that runs /petfollow?

    I can but then I will have to deal with targeting for that button.

    Still I believe there should be a direct binding.

    Perhaps you should make a suggestion to Blizzard then!

    I kept diging and I found that the functions API were PetAttack, PetFollow and else;

    If I :

    print(PetFollow) out side the handlers enviromet I get the return showing that there is a function (a protected function by the way)

    but sadly when I try to print them from inside the handlers enviroment I got a nil return (as if they were omited dunno why =S ).

    Even if it is a protected fuction the Bind action is possible but not from inside a handler.

    I even tryed to create a frame refrense to the fuctions but I shall conclude that creating a macro text action button will be the easier and more fuctional way (Already had and worked).

    Thanks for your time.