1. How do I change the OnClick event for CloseButton when I'm getting it through the BasicFrameTemplate?

    For example,

     <Frame name="MyFrame" inherits="BasicFrameTemplate" />
     </Frame>
    

    MyFrame has a close button because BasicFrameTemplate inherits a close button. I can see, using /Framestack that there is a table named CloseButton in MyFrame. But if I try to do, MyFrameCloseButton:SetScript("OnClick", someFunction()) or MyFrame.CloseButton:SetScript("OnClick", someFunction())

    , I get an error, as if MyFrame doesn't exist.

    MyFrame.CloseButton:SetScript()