function Test()
-- create the button and place it onto the center of the screen
local button = BlzCreateFrame("ScriptDialogButton", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0, 0)
BlzFrameSetAbsPoint(button, FRAMEPOINT_CENTER, 0.4, 0.3)
BlzFrameSetSize(button, 0.039, 0.039)
-- create a Sprite that copies the button's positions
local model = BlzCreateFrameByType("SPRITE", "SpriteName", button, "", 0)
BlzFrameSetAllPoints(model, button)
-- apply the model
BlzFrameSetModel(model, "UI\\Feedback\\Autocast\\UI-ModalButtonOn.mdl", 0)
-- Models don't care about Frame Size, to resize them one needs to scale them. The default CommandButton has a Size of 0.039.
BlzFrameSetScale(model, BlzFrameGetWidth(button)/0.039)
end
function Test takes nothing returns nothing
// create the button and place it onto the center of the screen
local framehandle button = BlzCreateFrame("ScriptDialogButton", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0, 0)
// create a Sprite frame
local framehandle model = BlzCreateFrameByType("SPRITE", "SpriteName", button, "", 0)
// position and size the button frame
call BlzFrameSetAbsPoint(button, FRAMEPOINT_CENTER, 0.4, 0.3)
call BlzFrameSetSize(button, 0.039, 0.039)
// Note: I had to create the Sprite frame a few lines up because you can only declare local variables at the start of a Jass function
// this makes the model copy the position of the button
call BlzFrameSetAllPoints(model, button)
// apply the model
call BlzFrameSetModel(model, "UI\\Feedback\\Autocast\\UI-ModalButtonOn.mdl", 0)
// Models don't care about Frame Size, to resize them one needs to scale them. The default CommandButton has a Size of 0.039.
call BlzFrameSetScale(model, BlzFrameGetWidth(button)/0.039)
endfunction
call BlzFrameSetVisible(btn, false)