- Joined
- Aug 26, 2016
- Messages
- 99
How to create a clickable button with a tooltip in jass, tutorials I found are in Lua.
local frame = BlzCreateFrame("ScriptDialogButton", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0, 0)
local framehandle frame = BlzCreateFrame("ScriptDialogButton", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0, 0)
Tasyen has you covered:I need an article or example on how to get started.
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
Convert it with your mind. Look at how similar most of this is:How and with what to convert the code?
local frame = BlzCreateFrame("ScriptDialogButton", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0, 0)
local framehandle frame = BlzCreateFrame("ScriptDialogButton", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0, 0)
-- place the Button to the center of the Screen
BlzFrameSetAbsPoint(frame, FRAMEPOINT_CENTER, 0.4, 0.3)
// place the Button to the center of the Screen
call BlzFrameSetAbsPoint(frame, FRAMEPOINT_CENTER, 0.4, 0.3)