Class: Frame#

Warcraft III's UI uses a proprietary format known as FDF (Frame Definition Files). This class provides the ability to manipulate and create them dynamically through code.

example Create a simple button.

// Create a "GLUEBUTTON" named "Facebutton", the clickable Button, for game UI
const buttonFrame = new Frame("FaceButton", Frame.fromOrigin(ORIGIN_FRAME_GAME_UI, 0), 0, 0, "GLUEBUTTON", "");
// Create a BACKDROP named "FaceButtonIcon", the visible image, for buttonFrame.
const buttonIconFrame = new Frame("FaceButton", buttonFrame, 0, 0, "BACKDROP", "");
// buttonIconFrame will mimic buttonFrame in size and position
buttonIconFrame.setAllPoints(buttonFrame);
// Set a Texture
buttonIconFrame.setTexture("ReplaceableTextures\\CommandButtons\\BTNSelectHeroOn", 0, true);
// Place the buttonFrame to the center of the screen
buttonFrame.setAbsPoint(FRAMEPOINT_CENTER, 0.4, 0.3);
// Give that buttonFrame a size
buttonFrame.setSize(0.05, 0.05);

There are many aspects to modifying the UI and it can become complicated, so here are some guides:

https://www.hiveworkshop.com/threads/ui-frames-starting-guide.318603/ https://www.hiveworkshop.com/pastebin/913bd439799b3d917e5b522dd9ef458f20598/ https://www.hiveworkshop.com/tags/ui-fdf/

Hierarchy#

  • Handle<framehandle>

    ↳ Frame

Constructors#

constructor#

new Frame(name: string, owner: Frame, priority: number, createContext: number): Frame

Creates a Frame.

Parameters:#

NameTypeDescription
namestringThe name of the frame to be accessed with Frame.fromName.
ownerFrameThe parent frame.
prioritynumber
createContextnumberThe ID assigned to a frame to be accessed with Frame.fromName. This value does not have to be unique and can be overwritten.

Returns: Frame

Defined in: handles/frame.ts:37

new Frame(name: string, owner: Frame, priority: number): Frame

Creates a SimpleFrame.

https://www.hiveworkshop.com/threads/ui-simpleframes.320385/

Parameters:#

NameTypeDescription
namestringThe name of the frame to be accessed with Frame.fromName.
ownerFrameThe parent frame.
prioritynumber

Returns: Frame

Defined in: handles/frame.ts:45

new Frame(name: string, owner: Frame, priority: number, createContext: number, typeName: string, inherits: string): Frame

Create a Frame by type.

Parameters:#

NameTypeDescription
namestringThe name of the frame to be accessed with Frame.fromName.
ownerFrameThe parent frame.
prioritynumber
createContextnumberThe ID assigned to a frame to be accessed with Frame.fromName. This value does not have to be unique and can be overwritten.
typeNamestringThe type of Frame.
inheritsstringThe name of the Frame it inherits.

Returns: Frame

Defined in: handles/frame.ts:55

Properties#

handle#

• Readonly handle: framehandle

Inherited from: Handle.handle

Defined in: handles/handle.ts:6

Accessors#

alpha#

alpha(): number

Returns: number

Defined in: handles/frame.ts:86

alpha(alpha: number): void

Parameters:#

NameType
alphanumber

Returns: void

Defined in: handles/frame.ts:82


children#

children(): Frame[]

Returns: Frame[]

Defined in: handles/frame.ts:90


childrenCount#

childrenCount(): number

Returns: number

Defined in: handles/frame.ts:99


enabled#

enabled(): boolean

Returns: boolean

Defined in: handles/frame.ts:107

enabled(flag: boolean): void

Parameters:#

NameType
flagboolean

Returns: void

Defined in: handles/frame.ts:103


height#

height(): number

Returns: number

Defined in: handles/frame.ts:115

height(height: number): void

Parameters:#

NameType
heightnumber

Returns: void

Defined in: handles/frame.ts:111


id#

id(): number

Get the unique ID of the handle. The ID is recycled once you destroy the object.

Returns: number

The unique ID of a handle object.

Defined in: handles/handle.ts:18


parent#

parent(): Frame

Returns: Frame

Defined in: handles/frame.ts:123

parent(parent: Frame): void

Parameters:#

NameType
parentFrame

Returns: void

Defined in: handles/frame.ts:119


text#

text(): string

Returns: string

Defined in: handles/frame.ts:131

text(text: string): void

Parameters:#

NameType
textstring

Returns: void

Defined in: handles/frame.ts:127


textSizeLimit#

textSizeLimit(): number

Returns: number

Defined in: handles/frame.ts:139

textSizeLimit(size: number): void

Parameters:#

NameType
sizenumber

Returns: void

Defined in: handles/frame.ts:135


value#

value(): number

Returns: number

Defined in: handles/frame.ts:147

value(value: number): void

Parameters:#

NameType
valuenumber

Returns: void

Defined in: handles/frame.ts:143


visible#

visible(): boolean

Returns: boolean

Defined in: handles/frame.ts:155

visible(flag: boolean): void

Parameters:#

NameType
flagboolean

Returns: void

Defined in: handles/frame.ts:151


width#

width(): number

Returns: number

Defined in: handles/frame.ts:163

width(width: number): void

Parameters:#

NameType
widthnumber

Returns: void

Defined in: handles/frame.ts:159

Methods#

addText#

addText(text: string): Frame

Parameters:#

NameType
textstring

Returns: Frame

Defined in: handles/frame.ts:167


cageMouse#

cageMouse(enable: boolean): Frame

Parameters:#

NameType
enableboolean

Returns: Frame

Defined in: handles/frame.ts:172


clearPoints#

clearPoints(): Frame

Returns: Frame

Defined in: handles/frame.ts:177


click#

click(): Frame

Returns: Frame

Defined in: handles/frame.ts:182


destroy#

destroy(): Frame

Returns: Frame

Defined in: handles/frame.ts:187


getChild#

getChild(index: number): Frame

Parameters:#

NameType
indexnumber

Returns: Frame

Defined in: handles/frame.ts:192


setAbsPoint#

setAbsPoint(point: framepointtype, x: number, y: number): Frame

Parameters:#

NameType
pointframepointtype
xnumber
ynumber

Returns: Frame

Defined in: handles/frame.ts:196


setAllPoints#

setAllPoints(relative: Frame): Frame

Parameters:#

NameType
relativeFrame

Returns: Frame

Defined in: handles/frame.ts:201


setAlpha#

setAlpha(alpha: number): Frame

Parameters:#

NameType
alphanumber

Returns: Frame

Defined in: handles/frame.ts:206


setEnabled#

setEnabled(flag: boolean): Frame

Parameters:#

NameType
flagboolean

Returns: Frame

Defined in: handles/frame.ts:211


setFocus#

setFocus(flag: boolean): Frame

Parameters:#

NameType
flagboolean

Returns: Frame

Defined in: handles/frame.ts:216


setFont#

setFont(filename: string, height: number, flags: number): Frame

Parameters:#

NameType
filenamestring
heightnumber
flagsnumber

Returns: Frame

Defined in: handles/frame.ts:221


setHeight#

setHeight(height: number): Frame

Parameters:#

NameType
heightnumber

Returns: Frame

Defined in: handles/frame.ts:226


setLevel#

setLevel(level: number): Frame

Parameters:#

NameType
levelnumber

Returns: Frame

Defined in: handles/frame.ts:231


setMinMaxValue#

setMinMaxValue(minValue: number, maxValue: number): Frame

Parameters:#

NameType
minValuenumber
maxValuenumber

Returns: Frame

Defined in: handles/frame.ts:236


setModel#

setModel(modelFile: string, cameraIndex: number): Frame

Parameters:#

NameType
modelFilestring
cameraIndexnumber

Returns: Frame

Defined in: handles/frame.ts:241


setParent#

setParent(parent: Frame): Frame

Parameters:#

NameType
parentFrame

Returns: Frame

Defined in: handles/frame.ts:246


setPoint#

setPoint(point: framepointtype, relative: Frame, relativePoint: framepointtype, x: number, y: number): Frame

Parameters:#

NameType
pointframepointtype
relativeFrame
relativePointframepointtype
xnumber
ynumber

Returns: Frame

Defined in: handles/frame.ts:251


setScale#

setScale(scale: number): Frame

Parameters:#

NameType
scalenumber

Returns: Frame

Defined in: handles/frame.ts:256


setSize#

setSize(width: number, height: number): Frame

Parameters:#

NameType
widthnumber
heightnumber

Returns: Frame

Defined in: handles/frame.ts:261


setSpriteAnimate#

setSpriteAnimate(primaryProp: number, flags: number): Frame

Parameters:#

NameType
primaryPropnumber
flagsnumber

Returns: Frame

Defined in: handles/frame.ts:266


setStepSize#

setStepSize(stepSize: number): Frame

Parameters:#

NameType
stepSizenumber

Returns: Frame

Defined in: handles/frame.ts:271


setText#

setText(text: string): Frame

Parameters:#

NameType
textstring

Returns: Frame

Defined in: handles/frame.ts:276


setTextColor#

setTextColor(color: number): Frame

Parameters:#

NameType
colornumber

Returns: Frame

Defined in: handles/frame.ts:281


setTextSizeLimit#

setTextSizeLimit(size: number): Frame

Parameters:#

NameType
sizenumber

Returns: Frame

Defined in: handles/frame.ts:286


setTexture#

setTexture(texFile: string, flag: number, blend: boolean): Frame

Parameters:#

NameType
texFilestring
flagnumber
blendboolean

Returns: Frame

Defined in: handles/frame.ts:291


setTooltip#

setTooltip(tooltip: Frame): Frame

Parameters:#

NameType
tooltipFrame

Returns: Frame

Defined in: handles/frame.ts:296


setValue#

setValue(value: number): Frame

Parameters:#

NameType
valuenumber

Returns: Frame

Defined in: handles/frame.ts:301


setVertexColor#

setVertexColor(color: number): Frame

Parameters:#

NameType
colornumber

Returns: Frame

Defined in: handles/frame.ts:306


setVisible#

setVisible(flag: boolean): Frame

Parameters:#

NameType
flagboolean

Returns: Frame

Defined in: handles/frame.ts:311


setWidth#

setWidth(width: number): Frame

Parameters:#

NameType
widthnumber

Returns: Frame

Defined in: handles/frame.ts:316


autoPosition#

static autoPosition(enable: boolean): void

Parameters:#

NameType
enableboolean

Returns: void

Defined in: handles/frame.ts:321


fromEvent#

static fromEvent(): Frame

Returns: Frame

Defined in: handles/frame.ts:325


fromHandle#

static fromHandle(handle: framehandle): Frame

Parameters:#

NameType
handleframehandle

Returns: Frame

Defined in: handles/frame.ts:329


fromName#

static fromName(name: string, createContext: number): Frame

Parameters:#

NameType
namestring
createContextnumber

Returns: Frame

Defined in: handles/frame.ts:333


fromOrigin#

static fromOrigin(frameType: originframetype, index: number): Frame

Parameters:#

NameType
frameTypeoriginframetype
indexnumber

Returns: Frame

Defined in: handles/frame.ts:337


getEventHandle#

static getEventHandle(): frameeventtype

Returns: frameeventtype

Defined in: handles/frame.ts:341


getEventText#

static getEventText(): number

Returns: number

Defined in: handles/frame.ts:345


getEventValue#

static getEventValue(): number

Returns: number

Defined in: handles/frame.ts:349


hideOrigin#

static hideOrigin(enable: boolean): void

Parameters:#

NameType
enableboolean

Returns: void

Defined in: handles/frame.ts:353


loadTOC#

static loadTOC(filename: string): boolean

Parameters:#

NameType
filenamestring

Returns: boolean

Defined in: handles/frame.ts:357