function MyFirstButtonCallback takes nothing returns nothing
local framehandle frame = BlzGetTriggerFrame()
call DisplayTextToPlayer(Player(0), 0, 0, BlzFrameGetName(frame) + " was Clicked")
set frame = null
endfunction
function MyFirstButton takes nothing returns nothing
local trigger t = CreateTrigger()
// create a new Button which inherits from "ScriptDialogButton"
local framehandle frame = BlzCreateFrameByType("GLUETEXTBUTTON", "MyScriptDialogButton", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "ScriptDialogButton", 0)
// place the Button to the center of the Screen
call BlzFrameSetAbsPoint(frame, FRAMEPOINT_CENTER, 0.4, 0.3)
// set the Button's text
call BlzFrameSetText(frame, "My Button Text")
// register the Click event
call BlzTriggerRegisterFrameEvent(t, frame, FRAMEEVENT_CONTROL_CLICK)
// this happens when the button is clicked
call TriggerAddAction(t, function MyFirstButtonClicked)
set t = null
set frame = null
endfunction