I understand the value of following good practices, but as far as I know a frame defined as "button" handles mouseClick by default.
Anyhow, I tested with
button:SetMouseClickEnabled() without success.
PostClick script works, so the button is active and correctly responds to clicks. The problem comes from:
Lua Code:
button:SetAttribute("type", "macro")
button:SetAttribute("macrotext", "/sit")
Concerning the macro itself (/sit), it's just a basic example used in my tests.
As the buttons in part of my addon
NPCsMarker, the real macro is something like "/wm 1" or "/cwm 1" to place or clear ground markers.