Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
once you have these natives, you need to look framedef, folder in war3mod folder, then look for fdf files. If you don't know what you're doing, I'd advise you to specifically look for standard templates.fdf file.
Originframetypes are built in frames which one can manipulate or use as parents for own custom created frames. They are important cause the frame creation natives provided requier each frame to have a parent.
One can get a frame out of such an originframetype with that native.
JASS:
native BlzGetOriginFrame takes originframetype frameType, integer index returns framehandle
for the first argument pick one of the constants, for the second one choose in most cases 0, if the origin frame has more that 1, you can get other ones of that originframetype by using an higher number.
Constant
Info1
info2
ORIGIN_FRAME_GAME_UI
without it nothing will be displayed.
ORIGIN_FRAME_WORLD_FRAME
the visible playground, units items effects fog ... every object participating in the game is displayed on it.
ORIGIN_FRAME_HERO_BAR
parent of all HERO_BUTTONS,
HeroButons share the same visiblity.
ORIGIN_FRAME_HERO_BUTTON
[0 to 6]
the clickable buttons of own/allied heroes on the left of the screen
ORIGIN_FRAME_HERO_HP_BAR
[0 to 6]
connected to HeroButtons
ORIGIN_FRAME_HERO_MANA_BAR
[0 to 6]
connected to HeroButtons
ORIGIN_FRAME_HERO_BUTTON_INDICATOR
[0 to 6]
connected to HeroButtons
ORIGIN_FRAME_ITEM_BUTTON
[0 to 5]
Items in the inventory. Reappear/updates every selection.
ORIGIN_FRAME_COMMAND_BUTTON
[0 to 11]
the buttons to order units around, like ITEM_BUTTON, Reappear/update every selection.
ORIGIN_FRAME_SYSTEM_BUTTON
[0 to 3]
{Menu, allies, Log/chat, Quest}
ORIGIN_FRAME_PORTRAIT
Face of the main selected Unit
ORIGIN_FRAME_MINIMAP
ORIGIN_FRAME_MINIMAP_BUTTON
Altering the Minimap
ORIGIN_FRAME_TOOLTIP
ORIGIN_FRAME_UBERTOOLTIP
Handles the basic tooltip Frame
ORIGIN_FRAME_CHAT_MSG
No Idea
ORIGIN_FRAME_UNIT_MSG
No Idea
ORIGIN_FRAME_TOP_MSG
Container of the UpKeep Change Warning Message, below the dayTime Clock
JASS:
function DebugOrigin takes nothing returns nothing
local integer a = 0
local integer b
local integer lastHandle
local integer current
loop
exitwhen a == 18
set b = 0
set lastHandle = 0
loop
set current = GetHandleId(BlzGetOriginFrame(ConvertOriginFrameType(a), b))
exitwhen lastHandle == current
call BJDebugMsg("["+I2S(a)+"]"+"["+I2S(b)+"]"+I2S(current))
set lastHandle = current
set b = b + 1
endloop
set a = a + 1
endloop
endfunction
There is also an other way to get frames built in.
BlzGetFrameByName loads an frame from an inner storage which has for each (index - name) combination one slot. Most ones use only index 0. Playerbased frames uses upto max playeramount (0 to 23). Also simpleframes do often use higher numbers then 0, the simpleFrames do that cause they reuse same frameTypes with same names. Now they increase the nr so you can access all of them with BlzGetFrameByName.
The problem with BlzGetFrameByName is, you have to get the names from the fdf warcraft 3 uses. This are 3 examples of such names.
ConsoleUI {Almost any default ingame UI-Elements is in some relation to ConsoleUI}.
UpperButtonBarFrame {Container of ORIGIN_FRAME_SYSTEM_BUTTONs}
ResourceBarFrame {Gold, Lumber, Food, Upkeep, FPS, APM, PING}
The list was generated by reading/interpreting all fdf files from warcraft 3 ptr 1.31 and reading all words in " " in each FrameHead found.
LeaderBoard/Multiboard do only work when the map created such one.
The subFrame text/Label/Image names for 0 to 5 are the same.
InfoPanelIconBackdrop/Value/level/Label are the frames showing the units data if local player has selected an single unit they are all part of SimpleInfoPanelUnitDetail.
("InfoPanelIconBackdrop", 0) is Attack one.
("InfoPanelIconBackdrop", 1) is Attack two.
("InfoPanelIconBackdrop", 2) is Armor.
("InfoPanelIconBackdrop", 3) is SpellCaster rank (tech).
("InfoPanelIconBackdrop", 4) is Food provided.
("InfoPanelIconBackdrop", 5) is Gold remaning (goldmine).
Hero Stats use unique names still use createcontext 6.
The Hero Stat Panel access.
One could repos the BackDrop to move each unit-info part individual one can also use BlzFrameGet/SetText on InfoPanelIconValue to read/write the value of the text shown to the local Player. (this text is async and should not be used for anything that needs to be synced). Also values the current unit does not posses are not upgraded and will return with GetText the values for the last unit selected having possed such a value.
Another way is to jump up parents using BlzFrameGetParent framehandle fh, this is not always possible and jumping up to some parents will break the game.
Sometimes its nice to know where/which frame that is. I found that native quite useful in that case, although it did not always work or it seemd not to work if the frame was to big:
native BlzFrameSetPoint takes framehandle frame, framepointtype point, framehandle relative, framepointtype relativePoint, real x, real y returns nothing
native BlzFrameSetAbsPoint takes framehandle frame, framepointtype point, real x, real y returns nothing
with BlzFrameSetPoint you set frame point offset by x/y to frame relative point.
For example BlzFrameSetPoint(imgFrame, FRAMEPOINT_CENTER, mainFrame, FRAMEPOINT_CENTER, 0.0, 0.0) would place imgFrame directly onto mainFrame, if they have the same size. The abs position of mainFrame on the screen does not matter.
Another example BlzFrameSetPoint(secButton, FRAMEPOINT_LEFT, mainButton, FRAMEPOINT_RIGHT, 0.01, 0.0) would grap secButton at its LEFT and move it using LEFT as its origin to mainButtons RIGHT with an x offset of 1% of xScreensize to the right. Would result into them beeing next to each other.
BlzFrameSetAbsPoint sets the framepoint to the absolute x/y of the screen.
It might be useful to use BlzFrameClearAllPoints takes framehandle frame to remove currently used points of a frame. Also not all FRAMEPOINTS might work for the Frames one wants to repos. In my testing for command Buttons TOPLEFT was quite successful.
For both natives x/y are factors of the 4:3 screens size: 0/0 is at the left bottom corner (4:3 Screen) and 0.8/0.6 at the right top corner (4:3 Screen). Even a hundredth has quite an impact on the result.
In Code one uses this native to set textalign BlzFrameSetTextAlignment takes framehandle frame, textaligntype vert, textaligntype horz
Textaligntypes define the position text will take when the textFrame was given an rect beeing bigger than the space the text Needs to take by seting an Position and size or 2 Points that define a rect.
0, 1, 2 are for textaligntype vert
3, 4, 5 are for textaligntype horz
frameeventtypes are the possible events one can register to custom created frames. Not all frametypes can evoke events.
One registers a frameevent with
Inside a callback function executed by that trigger one has following informations:
BlzGetTriggerFrame - the frame evoking the event
BlzGetTriggerFrameEvent - the frameeventtype evoked
GetTriggerPlayer - the player evoking the event. (only tested in Single Player)
On default the toc-File "war3.w3mod\ui\framedef\framedef.toc" is loaded. Only frame definition loaded are working as intened. A toc file is a list of fdf-Files one wants to load, when Loading a toc-File each line represents one fdf. The fdf paths in the toc-File are relative to the game/map root as one is used to in warcraft 3 mapping.
A TOC File should end with an empty line.
In Ptr 1.31 "framedef.toc" does not include "UI\FrameDef\Glue\standardtemplates.fdf" nor "UI\FrameDef\UI\escmenutemplates.fdf", these 2 are defining most basic UI-Elements.
There exist 3 Framecreating natives on 1.31 ptr. One should use "BlzCreateFrame".
Sometimes created frames take over the keyboard foucs when clicked results into disabling hotkeys. The normal game regains keyboard focus when the user is left clicking the world frame, although a forced click had no effect.
Frames generated using BlzCreateFrame use more of the built in rules/Textures, also they create all subframes.
BlzCreateFrame can only create mainFrames beeing defined in a loaded fdf-File, fdf files are loaded over toc-files. MainFrames have a definitionHead outside of any others frame's body.
When creating a mainFrames all subFrames of that Frame are created. One can access such generated subFrames with BlzGetFrameByName(<2keyWordString after Frame>, <same Nr as used inside BlzCreateFrame>) the secondKeyWordString is the unique name of that FrameType. On default the File "war3.w3mod\ui\framedef\framedef.toc" is loaded.
BlzCreateFrame is overall the best choice of the 3 frame creation natives.
BlzCreateSimpleFrame can only create Frames having SIMPLE in their 1.Keyword of the Frame definition head, it has the same limitation as BlzCreateFrame only beeing able to create mainFrames. As written above simpleframes occupy on default some createContex indexes, if you want to not lose access to the default ones avoid colisons with your custom ones. SimpleFrames are placed below Frames.
Code:
Frame "SIMPLEFRAME" x (INHERITS y) {
1.Keyword - SIMPLEFRAME
2.Keyword - x
one uses x as name to create.
SimpleFrames can have only simple-Frames as children and can not be created by CreateFrame. There are other SubFrames only exsiting inside SimpleFrames. They can have String "name" INHERITS "x" and Texture "name" INHERITS "x". Textures and Strings are also accessed in jass with BlzGetFrameByName but they can not exist alone.
BlzCreateFrameByType can create any Frame but it has more arguments then the others and it is the one you wana use when you want to built the frame yourself. It will not generate subFrames. Does also allow to generate Frames not defined/loaded in such a case the created frame has hardly any of the wanted behaviour.
typename is the 1.Keyword
inherits is the 2.Keyword
name
createContext - no idea
Currently I think its the index of an hidden inner framehandle array your new created frame and its subframes will take. If one uses 8 then one can load the frame and its subFrames with BlzGetFrameByName(<name>, 8). If that is the case one would not need global framevariables, when one uses clean uniue indexes. I did not tests for max min values.
Frames handling user input won't sync their state. User input has only an effect on the player doing that input.
When an checkbox is displayed and for example User A clicks it; only for User A will the checkbox be in the checked state. This also applies to editboxes and sliders.
Therefore using BlzFrameGetText(Editbox) or BlzFrameGetValue(Slider) are likely to produce a disconnect, cause their values are local and differ, if any player did a change (but user input is their purpose).
FrameEvents are synced and ptr (1.31) brought natives, to get the active frame, the player using the frame and the frames new text/value.
"BlzGetTriggerFrameValue" and "BlzGetTriggerFrameText" are not included in common.j (PTR 1.31) but can be used when one uses vjass (no idea about Lua) by declaring them in the map head (write them there)
I somewhere read there is an further one, but I did not find it anymore.
Frame -> BlzCreateFrame
QuestCheckBox
DebugButton
ScriptDialog
ScriptDialogButton
SuspendDialog with Checks
ListBoxWar3
StandardDecoratedEditBoxTemplate
StandardSliderTemplate
RadioButton
Glowing Button with Tooltip Frame
Button by BlzCreateFrameByType
MyStatusBar
This is a Frame definition from "war3.w3mod/ui/framedef/glue/standardtemplates.fdf".
It is an Backdrop with an default size of (0.11 / 0.055) . It's name is "StandardMenuTinyButtonBaseBackdrop"
This is a Frame definition from "war3.w3mod/ui/framedef/ui/scriptdialog.fdf".
It is a "GLUETEXTBUTTON" and its name is "ScriptDialogButton" it does takeover data from "EscMenuButtonTemplate" WITHCHILDREN means it will also copy subFrames .
"ScriptDialogButton" has a subFrame named "ScriptDialogButtonText" which is a "TEXT" which is based on a frame named "EscMenuButtonTextTemplate"
one creates the mainFrame "ScriptDialogButton", directly after having created the mainFrame one has access to the subFrames with BlzGetFrameByName. The subframe in this case would allow to change the ButtonsText cause it is managing it.
FrameTypes:
BACKDROP
BUTTON
CHATDISPLAY
CHECKBOX
CONTROL
DIALOG
EDITBOX
FRAME
GLUEBUTTON
GLUECHECKBOX
GLUEEDITBOX
GLUEPOPUPMENU
GLUETEXTBUTTON
HIGHLIGHT
LISTBOX
MENU
MODEL
POPUPMENU
SCROLLBAR
SIMPLEBUTTON
SIMPLECHECKBOX
SIMPLEFRAME
SIMPLESTATUSBAR
SLASHCHATBOX
SLIDER
SPRITE
TEXT
TEXTAREA
TEXTBUTTON
TIMERTEXT
Inside an fdf file:
DecorateFileNames - allows to lookup paths by string constants written in gameinterface or somewhere else.
UseActiveContext - disallows clicking the space the frame takes and subframes can refer to it.
Height - define a default height used when creating that frame
Width - define a default width
BackdropEdgeFile - The File beeing used as border, setting texture (by code) overwrites that value.
FontColor 0.990.8270.0705 1.0, //Red Green Blue Alpha 0.0 to 1.0
FontDisabledColor 0.99 0.827 0.0705 1.0, //Color used when Fram is SetEnable(false)
Code:
Frame "BACKDROP" "BoxedTextBackgroundTemplate" {
DecorateFileNames, //Look-Up Names in some String table (for example gameinterface)
BackdropTileBackground,
BackdropBackground "ToolTipBackground", //BackgroundFile
BackdropCornerFlags "UL|UR|BL|BR|T|L|B|R",
BackdropCornerSize 0.008, //higher numbers make the corners rounder.
BackdropBackgroundInsets 0.0022 0.0022 0.0022 0.0022, //makes the background start by an offset from the outside.
BackdropEdgeFile "ToolTipBorder", //the border File
BackdropBlendAll,
}
QuestCheckBox is a out of the box working checkbox with all textures need for a checkbox, when created with BlzCreateFrame. It is found in questdialog.fdf
There are also "QuestCheckBox2" and "QuestCheckBox3" which are smaller.
QuestCheckbox(2)(3) have a size defined in the fdf means, if one creates it with BlzCreateFrame they will use that size without setting BlzFrameSetSize.
As checkbox one should atleast attach the frameEvents: FRAMEEVENT_CHECKBOX_CHECKED & FRAMEEVENT_CHECKBOX_UNCHECKED to know what players toggled.
JASS:
function TestQuestCheckbox takes nothing returns nothing
//Create an Checkbox with border and (un)checked textures
//supports FRAMEEVENT_CHECKBOX_CHECKED, FRAMEEVENT_CHECKBOX_UNCHECKED, FRAMEEVENT_MOUSE_ENTER, FRAMEEVENT_MOUSE_LEAVE
//"QuestCheckBox" is the big checkBox
//"QuestCheckBox2" is the smaller one; one could also set size, if one wants a different size then the default ones.
local framehandle fh = BlzCreateFrame("QuestCheckBox", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI,0), 0,0) // one could also use "QuestCheckBox2" or "QuestCheckBox3" to spawn a smaller one
call BlzFrameSetAbsPoint(fh, FRAMEPOINT_CENTER, 0.4,0.4)
call TestRegisterEvents(fh)
endfunction
DebugButton is a TextButton with a blue background, border and yellow colored text. They look like the buttons in the main menu after starting the game. "BrowserButton", "ReplayButton" seem to be almost the same except for the default Text. They are found in mainmenu.fdf.
JASS:
function TestDebugButton takes nothing returns nothing
//Creates an TextButton having an border, a blue background yellow colored text and a glue effect when hovering
local framehandle mainButton = BlzCreateFrame("DebugButton", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI,0), 0,0)//Create the mainButton and all its childs
local framehandle textChild = BlzGetFrameByName("DebugButtonText",0) //Get the Frame displaying the text for mainButton
call BlzFrameSetAbsPoint(mainButton, FRAMEPOINT_CENTER, 0.4,0.4) //set position of the mainButton
call BlzFrameSetSize(mainButton, 0.15,0.02) //set its x y size
call BlzFrameSetText(textChild, "My Test Text")
call TestRegisterEvents (mainButton) //supports FRAMEEVENT_CONTROL_CLICK, FRAMEEVENT_MOUSE_ENTER, FRAMEEVENT_MOUSE_LEAVE
endfunction
"ScriptDialog" is a box/container using players race textures and having an title.
JASS:
function TestScriptDialog takes nothing returns nothing
//Creates an container having an background, border and title background and border match the players race Textures title is yellow colored.
local framehandle box = BlzCreateFrame("ScriptDialog", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI,0), 0,0)
local framehandle boxTitle = BlzGetFrameByName("ScriptDialogText",0)
call BlzFrameSetSize(box, 0.2,0.5) //has a default size but one can overwrite it.
call BlzFrameSetAbsPoint(box, FRAMEPOINT_CENTER, 0.4,0.35)
call BlzFrameSetText(boxTitle, "Mein Title")
endfunction
Is the button using players race textures.
JASS:
function TestScriptDialogButton takes nothing returns nothing
//Creates an Button using the races background colors having a border, yellow colored text and a glue effect when hovering
local framehandle mainButton = BlzCreateFrame("ScriptDialogButton", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI,0), 0,0)
local framehandle buttonText = BlzGetFrameByName("ScriptDialogButtonText",0) //Get The buttons textChild
call BlzFrameSetSize(mainButton, 0.2,0.05) //has no default size so you have to set it.
call BlzFrameSetAbsPoint(mainButton, FRAMEPOINT_CENTER, 0.4,0.35)
call BlzFrameSetText(buttonText, "Mein ButtonText")
call TestRegisterEvents (mainButton) //Supports Enter, Leave, Control Click
endfunction
This one was used pre 1.30 when an player had network issues. Simlear to ScriptDialog but it has a button at the bottom and a label above the button.
Example for an Dialog with 3 checkboxes using SuspendDialog.
JASS:
function TestRaceBoxNCheckBox takes nothing returns nothing
//Creates an container having an background, border and title background and border match the players race Textures title is yellow colored.
//Although SuspendDialog might be a better base if one wants 1 button at the bottom.
local framehandle box = BlzCreateFrame("SuspendDialog", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI,0), 0,0)
local framehandle boxTitle = BlzGetFrameByName("SuspendTitleText",0)
local framehandle boxBottomText = BlzGetFrameByName("SuspendTimerText",0)
local framehandle checkA = BlzCreateFrame("QuestCheckBox", box, 0,0)
local framehandle checkB = BlzCreateFrame("QuestCheckBox", box, 0,0)
local framehandle checkC = BlzCreateFrame("QuestCheckBox", box, 0,0)
local framehandle mainButton = BlzGetFrameByName("SuspendDropPlayersButton",0)
local framehandle buttonText = BlzGetFrameByName("SuspendDropPlayersButtonText",0) //Get The buttons textChild
local framehandle checkALable = BlzCreateFrame("TeamLabelTextTemplate", checkA, 0,0 )
local framehandle checkBLable = BlzCreateFrame("TeamLabelTextTemplate", checkB, 0,0 )
local framehandle checkCLable = BlzCreateFrame("TeamLabelTextTemplate", checkC, 0,0 )
call BlzFrameSetAbsPoint(box, FRAMEPOINT_CENTER, 0.4,0.35)
call BlzFrameSetSize(box, 0.336,0.3) //has a default size but one can overwrite it.
call BlzFrameSetText(boxTitle, "Mein Title")
call BlzFrameSetText(buttonText, "ButtonText")
call BlzFrameSetText(checkALable, "Checkbox A")
call BlzFrameSetText(checkBLable, "Checkbox B")
call BlzFrameSetText(checkCLable, "Checkbox C")
call BlzFrameSetPoint(checkA, FRAMEPOINT_CENTER, box, FRAMEPOINT_CENTER, -0.1, 0)
call BlzFrameSetPoint(checkB, FRAMEPOINT_CENTER, box, FRAMEPOINT_CENTER, 0, 0)
call BlzFrameSetPoint(checkC, FRAMEPOINT_CENTER, box, FRAMEPOINT_CENTER, 0.1, 0)
call BlzFrameSetPoint(checkALable, FRAMEPOINT_TOP, checkA, FRAMEPOINT_BOTTOM, 0,0)
call BlzFrameSetPoint(checkBLable, FRAMEPOINT_TOP, checkB, FRAMEPOINT_BOTTOM, 0,0)
call BlzFrameSetPoint(checkCLable, FRAMEPOINT_TOP, checkC, FRAMEPOINT_BOTTOM, 0,0)
call TestRegisterEvents (checkA)
call TestRegisterEvents (checkB)
call TestRegisterEvents (checkC)
call TestRegisterEvents (mainButton) //one could also use the box, although the box would only support FRAMEEVENT_EDITBOX_ENTER, when using the button one has the 3 default button events. ControlClick, Enter, Leave
endfunction
is the container/box used in the main menu, the grey background and the border.
Non default Loaded FDF (PTR 1.31): "UI\FrameDef\Glue\standardtemplates.fdf"
Inside the Event one should use BlzGetTriggerFrameText to get the value the user did write into.
(PTR 1.31) BlzGetTriggerFrameText is not included in Common.j.
Non default Loaded FDF (PTR 1.31): "UI\FrameDef\Glue\standardtemplates.fdf"
A slider is an ui Element which allows the user to choose a value between an upper and lower limit.
Inside the Event one should use BlzGetTriggerFrameValue to get the value the user did choose.
(PTR 1.31) BlzGetTriggerFrameValue is not included in Common.j.
Non default Loaded FDF (PTR 1.31): "UI\FrameDef\UI\escmenutemplates.fdf" or "UI\FrameDef\Glue\battlenettemplates.fdf"
BattleNetRadioButtonTemplate
EscMenuRadioButtonTemplate
RadioButtons in warcraft 3 are just round checkboxes.
BattlenetRadioButton is bigger but has no audio feedback when clicking.
Aeryn showed me this glowing buttons when ones uses the buttons from scorescreen.
I used that listbox for the tooltip because on default one can not generate a textarea, ugly (PTR 1.31). Could be solved by loading it with an imported toc.file would simple it down.
JASS:
function TestFrameEvent takes nothing returns nothing
//call BJDebugMsg("TestFrameEvent")
//call BJDebugMsg("Player: "+GetPlayerName(GetTriggerPlayer()))
if BlzGetTriggerFrameEvent() ==FRAMEEVENT_CONTROL_CLICK then
call BJDebugMsg("FRAMEEVENT_CONTROL_CLICK")
elseif BlzGetTriggerFrameEvent() == FRAMEEVENT_MOUSE_ENTER then
call BJDebugMsg("FRAMEEVENT_MOUSE_ENTER")
elseif BlzGetTriggerFrameEvent() == FRAMEEVENT_MOUSE_LEAVE then
call BJDebugMsg("FRAMEEVENT_MOUSE_LEAVE")
endif
endfunction
function TestClickableButton takes nothing returns nothing
local trigger trig = CreateTrigger()
local framehandle mainbutton = BlzCreateFrame("ScoreScreenBottomButtonTemplate", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI,0), 0, 0)
local framehandle imgFrame = BlzGetFrameByName("ScoreScreenButtonBackdrop", 0)
local framehandle tooltipBox = BlzCreateFrame("ListBoxWar3", mainbutton, 0, 0)
local framehandle tooltip = BlzCreateFrameByType("TEXT", "StandardInfoTextTemplate", tooltipBox, "StandardInfoTextTemplate", 0)
call BlzFrameSetSize(mainbutton, 0.04, 0.04)
call BlzFrameSetSize(tooltipBox, 0.3, 0.1)
call BlzFrameSetSize(tooltip, 0.28, 0.08)//tooltip-Text is smaller than the box, so it wont touch the border.
call BlzFrameSetTexture(imgFrame, "ReplaceableTextures\\CommandButtons\\BTNPeasant.blp", 0, true) //set the image of the imgFrame, with 0 the texture is streched with 1 the frame is filled with that texture.
call BlzFrameSetAbsPoint(mainbutton, FRAMEPOINT_TOPLEFT, 0.4, 0.3) //positionate button on the screen
call BlzFrameSetPoint(tooltip, FRAMEPOINT_CENTER, tooltipBox, FRAMEPOINT_CENTER, 0.0, 0.0) //place tooltip into tooltipBox
call BlzFrameSetPoint(tooltipBox, FRAMEPOINT_BOTTOM, mainbutton, FRAMEPOINT_TOP, 0.0, 0.0) //place tooltipBox with its bottom to the mainButtons TOP. tooltipBox will be over the mainbutton
call BlzFrameSetTooltip(mainbutton, tooltipBox) //show tooltipBox only when mainbutton is hovered with the mouse.
call BlzFrameSetText(tooltip, "Sound\\Music\\mp3Music\\Credits.mp3|nSound\\Music\\mp3Music\\PH.mp3|n|cffffcc00Sound\\Music\\mp3Music\\War2IntroMusic.mp3") //text of the tooltip
call TriggerAddAction(trig, function TestFrameEvent)
call BlzTriggerRegisterFrameEvent(trig, fh, FRAMEEVENT_CONTROL_CLICK)
call BlzTriggerRegisterFrameEvent(trig, fh, FRAMEEVENT_MOUSE_ENTER)
call BlzTriggerRegisterFrameEvent(trig, fh, FRAMEEVENT_MOUSE_LEAVE)
endfunction
JASS:
function TestFrameEvent takes nothing returns nothing
//call BJDebugMsg("TestFrameEvent")
//call BJDebugMsg("Player: "+GetPlayerName(GetTriggerPlayer()))
call BJDebugMsg(BlzFrameGetName( BlzGetTriggerFrame()))
if BlzGetTriggerFrameEvent() ==FRAMEEVENT_CONTROL_CLICK then
call BJDebugMsg("FRAMEEVENT_CONTROL_CLICK")
elseif BlzGetTriggerFrameEvent() == FRAMEEVENT_MOUSE_ENTER then
call BJDebugMsg("FRAMEEVENT_MOUSE_ENTER")
elseif BlzGetTriggerFrameEvent() == FRAMEEVENT_MOUSE_LEAVE then
call BJDebugMsg("FRAMEEVENT_MOUSE_LEAVE")
endif
endfunction
function TestRegisterEvents takes framehandle fh returns nothing
local trigger trig = CreateTrigger()
call TriggerAddAction(trig, function TestFrameEvent)
call BlzTriggerRegisterFrameEvent(trig, fh, FRAMEEVENT_CONTROL_CLICK) //Button is clicked not supported by checkboxes
call BlzTriggerRegisterFrameEvent(trig, fh, FRAMEEVENT_MOUSE_ENTER)
call BlzTriggerRegisterFrameEvent(trig, fh, FRAMEEVENT_MOUSE_LEAVE)
endfunction
function TestClickableButton takes nothing returns nothing
local framehandle mainbutton = BlzCreateFrameByType("TEXTBUTTON", "mainButton", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI,0), "StandardButtonTemplate", 0)
local framehandle imgButton = BlzCreateFrameByType("BACKDROP", "imgButton", mainbutton, "ButtonBackdropTemplate", 0)
call BlzFrameSetSize(mainbutton, 0.04, 0.04)
call BlzFrameSetSize(imgButton, 0.04, 0.04)
call BlzFrameSetTexture(imgButton, "ReplaceableTextures\\CommandButtons\\BTNPeasant.blp", 0, true)
call BlzFrameSetAbsPoint(mainbutton, FRAMEPOINT_TOPLEFT, 0.4, 0.3)
call BlzFrameSetPoint(imgButton, FRAMEPOINT_CENTER, mainbutton, FRAMEPOINT_CENTER, 0.0, 0.0)
call TestRegisterEvents(mainbutton)
endfunction
This is an custom fdf which is based on text from replaypanel. Cause it is a custom written fdf, one would need to import both (a toc loading it and the fdf itself) inside the toc file one has to write the path one imported the fdf into.
An SIMPLESTATUSBAR can have values from 0 to 100 (0 beeing empty, 100 full).
Originframetypes are built in frames which one can manipulate or use as parents for own custom created frames. They are important cause the frame creation natives provided requier each frame to have a parent.
One can get a frame out of such an originframetype with that native.
JASS:
native BlzGetOriginFrame takes originframetype frameType, integer index returns framehandle
for the first argument pick one of the constants, for the second one choose in most cases 0, if the origin frame has more that 1, you can get other ones of that originframetype by using an higher number.
ORIGIN_FRAME_GAME_UI,
The game master frame without it nothing will be displayed.
ORIGIN_FRAME_WORLD_FRAME
the visible playground, units items effects fog ... every object participating in the game is displayed on it.
ORIGIN_FRAME_HERO_BAR
masterpanel of all ORIGIN_FRAME_HERO_BUTTON,
if you want to hide/show all HeroButons just toggle visibility for the HERO_BAR.
ORIGIN_FRAME_HERO_BUTTON [0 to 6]
the clickable buttons of own/allied heroes on the left of the screen
ORIGIN_FRAME_HERO_HP_BAR, connected to HeroButtons
ORIGIN_FRAME_HERO_MANA_BAR
ORIGIN_FRAME_HERO_BUTTON_INDICATOR
ORIGIN_FRAME_ITEM_BUTTON [0 to 5]
Items in the inventory. This frames Reappear/updates every selection.
ORIGIN_FRAME_COMMAND_BUTTON [0 to 11]
the buttons to order units around, like ITEM_BUTTON, they Reappear/update every selection.
ORIGIN_FRAME_SYSTEM_BUTTON [0 to 3] {Menu, allies, Log, Quest}
ORIGIN_FRAME_PORTRAIT
Face of the main selected Unit
ORIGIN_FRAME_MINIMAP
ORIGIN_FRAME_MINIMAP_BUTTON
Altering the Minimap, I forgot amount and order.
ORIGIN_FRAME_TOOLTIP
ORIGIN_FRAME_UBERTOOLTIP
ORIGIN_FRAME_CHAT_MSG, No Idea
ORIGIN_FRAME_UNIT_MSG, No Idea
ORIGIN_FRAME_TOP_MSG, No Idea
JASS:
function DebugOrigin takes nothing returns nothing
local integer a = 0
local integer b
local integer lastHandle
local integer current
loop
exitwhen a == 18
set b = 0
set lastHandle = 0
loop
set current = GetHandleId(BlzGetOriginFrame(ConvertOriginFrameType(a), b))
exitwhen lastHandle == current
call BJDebugMsg("["+I2S(a)+"]"+"["+I2S(b)+"]"+I2S(current))
set lastHandle = current
set b = b + 1
endloop
set a = a + 1
endloop
endfunction
There is also an other way to get frames built in.
The problem with BlzGetFrameByName is there is no nice clean list of valid names. Until now I found 3 which are not directly accessable with origingframetypes:
ConsoleUI {Many built in UI-Elements are in some relation to this one}.
UpperButtonBarFrame
ResourceBarFrame {Gold, Lumber, Food, Upkeep, FPS, APM, PING}
Another way is to jump up parents using BlzFrameGetParent framehandle fh, this is not always possible and jumping up to some parents will break the game.
Sometimes its nice to know where/which frame that is. I found that native quite useful in that case, although it did not always work or it seemd not to work if the frame was to big:
JASS:
call BlzFrameCageMouse(framehandle fh, true)
It forces the mouse into the frame.
They are used when positionating frames.
JASS:
native BlzFrameSetPoint takes framehandle frame, framepointtype point, framehandle relative, framepointtype relativePoint, real x, real y returns nothing
native BlzFrameSetAbsPoint takes framehandle frame, framepointtype point, real x, real y returns nothing
with BlzFrameSetPoint you set frame point offset by x/y to frame relative point.
For example BlzFrameSetPoint(Frame imgButton FRAMEPOINT_CENTER, mainButton FRAMEPOINT_CENTER, 0.0, 0.0) would place imgButton directly onto mainButton, if they have the same size. The abs position of mainButton on the screen does not matter here.
BlzFrameSetAbsPoint sets the framepoint to the absolute x/y of the screen.
For both natives x/y are factors of the screens size: 1 = 100% of the screens size of that dimension. 0/0 is at the left bottom corner and 1/1 at the right top corner. Even a hundredth has quite an impact on the result.
I have not used them yet, but they often mentioned in fdf (frame definition files) which are found in UI/Framedef/Glue or UI/Framedef/UI.
These fdf files contain frame templates one can create using the ui natives.
frameeventtypes are the possible events one can register to custom created frames. Not all frametypes can evoke events.
One registers a frameevent with
Inside a callback function executed by that trigger one has following informations:
BlzGetTriggerFrame - the frame evoking the event
BlzGetTriggerFrameEvent - the frameeventtype evoked
GetTriggerPlayer - the player evoking the event. (only tested in Single Player)
to create custom Frames you need a fdf and know its content, the warcraft 3 built in are automatically loaded for custom ones one need to load a custom written toc file listing it.
As one sees all 3 requier an owner framehandle. The difference between them is what the can create.
BlzCreateSimpleFrame can only create Frames having SIMPLEFRAME as 1.Keyword of the Frame definition head:
Code:
Frame "SIMPLEFRAME" x (INHERITS y) {
1.Keyword - SIMPLEFRAME
2.Keyword - x
one uses x as name to create.
BlzCreateFrameByType can create any Frame but it has more arguments then the others.
typename is the 1.Keyword
inherits is the 2.Keyword
name is a name you give this specific framehandle ,its for you.
createContext - no idea
I did no real tests with BlzCreateFrame.
Some Frames define subFrames when creating such a masterFrame you should also create sub Frames, if you want the behaviour that subFrames offer.
set mainFrame = BlzCreateFrameByType("MENU", "My PopUpMenu", parentFrame, "StandardSmallPopupMenuMenuTemplate",0)
set subFrame = BlzCreateFrameByType("BACKDROP", "My PopUpMenu", mainFrame, "StandardPopupMenuMenuBackdropTemplate",0)
one creates the mainFrame "StandardSmallPopupMenuMenuTemplate" and its children StandardPopupMenuMenuBackdropTemplate.
Normaly one would also have to set position and size of both to make them visible and useable.
Example for creating a clickable Button having an Icon.
JASS:
function TestFrameEvent takes nothing returns nothing
//call BJDebugMsg("TestFrameEvent")
//call BJDebugMsg("Player: "+GetPlayerName(GetTriggerPlayer()))
call BJDebugMsg(BlzFrameGetName( BlzGetTriggerFrame()))
if BlzGetTriggerFrameEvent() ==FRAMEEVENT_CONTROL_CLICK then
call BJDebugMsg("FRAMEEVENT_CONTROL_CLICK")
elseif BlzGetTriggerFrameEvent() == FRAMEEVENT_MOUSE_ENTER then
call BJDebugMsg("FRAMEEVENT_MOUSE_ENTER")
elseif BlzGetTriggerFrameEvent() == FRAMEEVENT_MOUSE_LEAVE then
call BJDebugMsg("FRAMEEVENT_MOUSE_LEAVE")
elseif BlzGetTriggerFrameEvent() == FRAMEEVENT_MOUSE_DOWN then
call BJDebugMsg("FRAMEEVENT_MOUSE_DOWN")
elseif BlzGetTriggerFrameEvent() == FRAMEEVENT_CHECKBOX_CHECKED then
call BJDebugMsg("FRAMEEVENT_CHECKBOX_CHECKED")
elseif BlzGetTriggerFrameEvent() == FRAMEEVENT_CHECKBOX_UNCHECKED then
call BJDebugMsg("FRAMEEVENT_CHECKBOX_UNCHECKED")
endif
endfunction
function TestRegisterEvents takes framehandle fh returns nothing
local trigger trig = CreateTrigger()
call TriggerAddAction(trig, function TestFrameEvent)
call BlzTriggerRegisterFrameEvent(trig, fh, FRAMEEVENT_CONTROL_CLICK) //Button is clicked not supported by checkboxes
call BlzTriggerRegisterFrameEvent(trig, fh, FRAMEEVENT_MOUSE_ENTER)
call BlzTriggerRegisterFrameEvent(trig, fh, FRAMEEVENT_MOUSE_LEAVE)
call BlzTriggerRegisterFrameEvent(trig, fh, FRAMEEVENT_CHECKBOX_CHECKED)
call BlzTriggerRegisterFrameEvent(trig, fh, FRAMEEVENT_CHECKBOX_UNCHECKED)
endfunction
function TestClickableButton takes nothing returns nothing
local framehandle mainbutton = BlzCreateFrameByType("TEXTBUTTON", "mainButton", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI,0), "StandardButtonTemplate", 0)
local framehandle imgButton = BlzCreateFrameByType("BACKDROP", "imgButton", mainbutton, "ButtonBackdropTemplate", 0)
call BlzFrameSetSize(mainbutton, 0.04, 0.04)
call BlzFrameSetSize(imgButton, 0.04, 0.04)
call BlzFrameSetTexture(imgButton, "ReplaceableTextures\\CommandButtons\\BTNPeasant.blp", 0, true)
call BlzFrameSetAbsPoint(mainbutton, FRAMEPOINT_TOPLEFT, 0.4, 0.3)
call BlzFrameSetPoint(imgButton, FRAMEPOINT_CENTER, mainbutton, FRAMEPOINT_CENTER, 0.0, 0.0)
call TestRegisterEvents(mainbutton)
endfunction
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.