кратко: показан пример как создавать контейнеры. Очень хорошо в этом помогает тип FRAME. Все данные данные можно записать на один контейнер. И когда нужно убрать окно со всеми данными, достаточно скрыть общий контейнер. Кроме того, можно наделать несколько контейнеров для переключения данных страниц/панелей. Когда вы нажимаете на кнопку “переключить на 1 страницу”, у вас происходит смена панелей
Предыдущие подстатьи с примерами довольно просты, объясняли и показывали работу одного типа фрейма для чайников. сейчас мы работаем с несколькими фреймами, и нужно показать их взаимодействие. автор хайва советует использовать правило "родитель-потомок". Нужно привязать группу фреймов к какому-то родителю.
И тут у нас не одна группа, а несколько групп - всего три группы. У каждого разное содержимое. Их часто называют контейнерами, панелью итд. В варкрафте в меню часто любят называть панелью, там просто содержимое заменяется на другие кнопки при нажатии кнопки.
По задумке у нас есть окно. И внизу есть 3 кнопки. Страницы изменяются нажатием одной из этих кнопок. По факту, они сменяют показ кнопок, один контейнер прячем. Другой отображается.
На первой странице представлена информация об Утере, на второй - набор кнопок, создающих единицу, и 3. простой калькулятор, который - * / для 2 изменяемых чисел.
Этот пример выполнен без специального файла fdf, но требует загрузки файла escmenutemplates.fdf. Это также показывает, насколько плохим может оказаться код UI-Frame.
Этот пример выполнен без специального файла fdf, но требует загрузки файла escmenutemplates.fdf. Это также показывает, насколько плохим может оказаться код UI-Frame.
В игре создают один общий контейнер типа “FRAME” - windowcontainerFrame, на который будут вешать другие контейнеры, и окно boxFrame. Создаем кнопку закрытия всего окна closeButton на родителя boxFrame, оно закрывает (скрывает) windowcontainerFrame. Тут вы должны вспомнить урок про связи родитель-потомок, когда вы прячете родителя windowcontainerFrame, то прячете все меню. Или наоборот, когда показываете, с ним появляются потомки. Создается еще вторая кнопка - showButton для открытия окна на родителя меню F10, оно будет появляться при вызове меню F10. showButton показывает windowcontainerFrame.
создаются 3 кнопки-переключатели страниц - buttonPage1 , buttonPage2 , buttonPage3 на родителя окна boxFrame. Также создают три контейнера типа FRAME: containerFramePage1, containerFramePage2, containerFramePage3. Нажатие на одну из кнопок, позволяет отобразить контейнер.
На 1 странице показана информация паладина с помощью TEXT, Backdrop и TextArea. На второй странице показаны набор кнопок с иконками героев, которые при нажатии создают на карте этого героя. А на третьей странице представлен калькулятор
огромный lua код
do
local real = MarkGameStarted
function MarkGameStarted()
real()
-- allow to generate Frames from ui\framedef\ui\escmenutemplates.fdf
BlzLoadTOCFile("war3mapImported\\Templates.toc")
-- create a hidden Frame a container for all
local windowcontainerFrame = BlzCreateFrameByType("FRAME", "", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)
-- create a box as child of the container
local boxFrame = BlzCreateFrameByType("BACKDROP", "", windowcontainerFrame, "EscMenuBackdrop", 0)
BlzFrameSetSize(boxFrame, 0.4, 0.4)
BlzFrameSetAbsPoint(boxFrame, FRAMEPOINT_CENTER, 0.4, 0.3)
-- The option to close (hide) the box
local closeButton = BlzCreateFrameByType("GLUETEXTBUTTON", "", boxFrame, "ScriptDialogButton", 0)
BlzFrameSetSize(closeButton, 0.03, 0.03)
BlzFrameSetText(closeButton, "X")
BlzFrameSetPoint(closeButton, FRAMEPOINT_TOPRIGHT, boxFrame, FRAMEPOINT_TOPRIGHT, 0, 0)
-- this trigger handles clicking the close Button, it hides the Logical super Parent when the close Button is clicked for the clicking Player.
local closeTrigger = CreateTrigger()
BlzTriggerRegisterFrameEvent(closeTrigger, closeButton, FRAMEEVENT_CONTROL_CLICK)
TriggerAddAction(closeTrigger, function()
if GetLocalPlayer() == GetTriggerPlayer() then
BlzFrameSetVisible(windowcontainerFrame, false)
end
end)
-- Because one can close (hide) the box, one also should be able to show it again, this is done with an button that is only visible while the player is in Menu (F10)
local showButton = BlzCreateFrameByType("GLUETEXTBUTTON", "", BlzGetFrameByName("InsideMainPanel",0), "ScriptDialogButton", 0)
BlzFrameSetSize(showButton, 0.08, 0.04)
BlzFrameSetText(showButton, "show Info Frame")
BlzFrameSetAbsPoint(showButton, FRAMEPOINT_BOTTOMLEFT, 0, 0.2)
local showTrigger = CreateTrigger()
BlzTriggerRegisterFrameEvent(showTrigger, showButton, FRAMEEVENT_CONTROL_CLICK)
TriggerAddAction(showTrigger, function()
if GetLocalPlayer() == GetTriggerPlayer() then
BlzFrameSetVisible(windowcontainerFrame, true)
end
end)
-- create 3 Buttons based on ScriptDialogButton
local buttonPage1 = BlzCreateFrameByType("GLUETEXTBUTTON", "", boxFrame, "ScriptDialogButton", 0)
local buttonPage2 = BlzCreateFrameByType("GLUETEXTBUTTON", "", boxFrame, "ScriptDialogButton", 0)
local buttonPage3 = BlzCreateFrameByType("GLUETEXTBUTTON", "", boxFrame, "ScriptDialogButton", 0)
BlzFrameSetSize(buttonPage1, 0.08, 0.03)
BlzFrameSetSize(buttonPage2, 0.08, 0.03)
BlzFrameSetSize(buttonPage3, 0.08, 0.03)
BlzFrameSetText(buttonPage1, "Page 1")
BlzFrameSetText(buttonPage2, "Page 2")
BlzFrameSetText(buttonPage3, "Page 3")
-- pos the 2.Button at the bottom
BlzFrameSetPoint(buttonPage2, FRAMEPOINT_BOTTOM, boxFrame, FRAMEPOINT_BOTTOM, 0, 0.017)
-- the 3. Button to it's right
BlzFrameSetPoint(buttonPage3, FRAMEPOINT_LEFT, buttonPage2, FRAMEPOINT_RIGHT, 0, 0)
-- the 1. Button to it's left
BlzFrameSetPoint(buttonPage1, FRAMEPOINT_RIGHT, buttonPage2, FRAMEPOINT_LEFT, 0, 0)
-- Now we got the button in order: 1 2 3, but don't have to bother the real position and sizes
-- create a Trigger handling the Page Button Clicks
local pageTrigger = CreateTrigger()
BlzTriggerRegisterFrameEvent(pageTrigger, buttonPage1, FRAMEEVENT_CONTROL_CLICK)
BlzTriggerRegisterFrameEvent(pageTrigger, buttonPage2, FRAMEEVENT_CONTROL_CLICK)
BlzTriggerRegisterFrameEvent(pageTrigger, buttonPage3, FRAMEEVENT_CONTROL_CLICK)
-- create a container Frame for each Page, this frames are mostly logical. They simple down the page swapping a lot.
local containerFramePage1 = BlzCreateFrameByType("FRAME", "", boxFrame, "", 0)
local containerFramePage2 = BlzCreateFrameByType("FRAME", "", boxFrame, "", 0)
local containerFramePage3 = BlzCreateFrameByType("FRAME", "", boxFrame, "", 0)
-- the containers are a bit smaller than the box to avoid colisions with the border and the buttons at the bottom
-- the containers are given a size to place contentFrames relative to the containers. This allows to place it to any valid coords and it will still work as wanted.
BlzFrameSetSize(containerFramePage1, 0.36, 0.3)
BlzFrameSetSize(containerFramePage2, 0.36, 0.3)
BlzFrameSetSize(containerFramePage3, 0.36, 0.3)
-- place the containers to the center of the box
BlzFrameSetPoint(containerFramePage1, FRAMEPOINT_TOP, boxFrame, FRAMEPOINT_TOP, 0, -0.03)
BlzFrameSetPoint(containerFramePage2, FRAMEPOINT_TOP, boxFrame, FRAMEPOINT_TOP, 0, -0.03)
BlzFrameSetPoint(containerFramePage3, FRAMEPOINT_TOP, boxFrame, FRAMEPOINT_TOP, 0, -0.03)
-- hide the page containers on default
BlzFrameSetVisible(containerFramePage1, false)
BlzFrameSetVisible(containerFramePage2, false)
BlzFrameSetVisible(containerFramePage3, false)
TriggerAddAction(pageTrigger, function()
local clickedButton = BlzGetTriggerFrame()
-- only the active player should be affected
if GetLocalPlayer() == GetTriggerPlayer() then
-- hide all pages, could be optimized monitoring the current selected but won't do that in this example.
BlzFrameSetVisible(containerFramePage1, false)
BlzFrameSetVisible(containerFramePage2, false)
BlzFrameSetVisible(containerFramePage3, false)
-- show the page based on the clicked button.
if clickedButton == buttonPage1 then
BlzFrameSetVisible(containerFramePage1, true)
elseif clickedButton == buttonPage2 then
BlzFrameSetVisible(containerFramePage2, true)
elseif clickedButton == buttonPage3 then
BlzFrameSetVisible(containerFramePage3, true)
end
end
end)
-- Page 1 Content
-- A page that shows some text about uther taken from https://wow.gamepedia.com/Uther_the_Lightbringer
local parent = containerFramePage1
local frame = BlzCreateFrameByType("BACKDROP", "", parent, "", 0)
BlzFrameSetSize(frame, 0.04, 0.04)
BlzFrameSetPoint(frame, FRAMEPOINT_TOPLEFT, parent, FRAMEPOINT_TOPLEFT, 0, 0)
BlzFrameSetTexture(frame, "ReplaceableTextures\\CommandButtons\\BTNHeroPaladin", 0, false)
frame = BlzCreateFrameByType("TEXT", "", parent, "", 0)
BlzFrameSetPoint(frame, FRAMEPOINT_TOPRIGHT, parent, FRAMEPOINT_TOPRIGHT, 0, 0)
BlzFrameSetText(frame, "Paladin of the Silver Hand")
BlzFrameSetScale(frame, 1.2)
frame = BlzCreateFrameByType("TEXT", "", parent, "", 0)
BlzFrameSetPoint(frame, FRAMEPOINT_TOPRIGHT, parent, FRAMEPOINT_TOPRIGHT, 0, -0.02)
BlzFrameSetText(frame, "Uther")
BlzFrameSetScale(frame, 1.3)
frame = BlzCreateFrameByType("TEXTAREA", "", parent, "EscMenuTextAreaTemplate", 0)
BlzFrameSetPoint(frame, FRAMEPOINT_BOTTOMRIGHT, parent, FRAMEPOINT_BOTTOMRIGHT, 0, 0)
BlzFrameSetPoint(frame, FRAMEPOINT_TOPLEFT, parent, FRAMEPOINT_TOPLEFT, 0, -0.05)
BlzFrameSetText(frame, "Lord Uther the Lightbringer, or Sire Uther Lightbringer, was the first of the five paladins of the Knights of the Silver Hand along with Turalyon, Saidan Dathrohan, Tirion Fordring, and Gavinrad the Dire. He led his order in the battle against the Horde during the Second War. During the Third War, Uther was betrayed and murdered by his beloved pupil, Prince Arthas, while defending the urn carrying the ashes of Arthas' father, King Terenas. After death, his soul was deemed worthy of entering the plane of Bastion within the Shadowlands. ")
BlzFrameAddText(frame, "|cffffcc00Personality|r|nThough zealous and weathered, Uther's eyes show kindness and wisdom. He is Lordaeron's self-appointed defender, but regrets that violence is the only way to solve some problems. Possessing a rich, commanding voice and great physical strength, Uther is also capable of gentleness and compassion, though he does not suffer fools. He is the epitome of the paladin warrior -- a mighty foe to his enemies and a bastion of hope to his allies.")
BlzFrameAddText(frame, "|cffffcc00In combat|r|nUther strides directly into melee, placing himself in the center of the most brutal combat. He places himself in danger to spare his allies. He is at his peak against demons and undead, and brings his full array of spells and abilities to bear against these creatures -- smites, banishing strikes, power turning, searing light from his hammer, hooks of binding and dispel evil. He uses lay on hands to blast undead that resist his hammer. Against truly mighty opponents, Uther attacks with his Big Smash feat. He prefers leading others into battle but fights alone if the situation warrants. Uther endangers himself to help others if he must, and is willing to sacrifice himself for others -- but he does not do so foolishly, as he knows how valuable he is to Lordaeron")
BlzFrameAddText(frame, "|cffffcc00Equipment|r")
BlzFrameAddText(frame, "|cffffcc00Hammer of the Lightbringer|r|nThe two-handed hammer's haft is polished mahogany, while the head is adamantine. A silver hand emblem rests in a bed of gold design on either side. This mighty weapon was forged when Archbishop Faol created the Knights of the Silver Hand, and the archbishop bequeathed it to the order's first Grand Master -- Uther the Lightbringer. A group of paladins recovered the hammer after Uther's death, but none has thought himself worthy of carrying the legendary weapon.")
BlzFrameAddText(frame, "|cffffcc00Gloves of the Silver Hand|r|nUther Lightbringer is said to have been the first to enchant these gloves to aid him in the battle against the Scourge. These are large, padded leather and mail gloves bleached pure white with the holy symbols of the Silver Hand burned into the palms. Although they are large mail items, they are remarkably light.")
BlzFrameAddText(frame, "Although the original shroud that covered the fallen paladin Uther Lightbringer of the Knights of the Silver Hand was lost years ago in frequent skirmishes between the Scourge and the Alliance, rumors of the shroud remain. Some of the remaining priests of the Holy Light have infused linen with power in honor of their fallen champion. These shrouds are made of soft, white linen, about 6 feet by 3 feet. The divine magic used to create these creates a gray image of a dead paladin, usually the face of the creator of the shroud.")
BlzFrameAddText(frame, "Uther is universally known as the Lightbringer but he hasn't been always addressed as such. In fact, it was General Turalyon who got the idea of this nickname after seeing the inspiration that the leader of the Silver Hand had on his men. When he was charged by Khadgar and Uther as Supreme Commander of the Alliance he responded: \"And I thank you, Uther the Lightbringer, \" Turalyon replied, and he saw the older Paladin's eyes widen at the new title. \"For so shall you be known henceforth, in honor of the Holy Light you brought us this day.\" Uther bowed, clearly pleased, then turned without another word and walked back toward the other knights of the Silver Hand, no doubt to tell them their marching orders.")
-- Page 2 Content
-- a col of custom Buttons this Page is bad done one actually should define a function to prevent the repeating same lines, but I won't do that in this example.
parent = containerFramePage2
local buttonTrigger = CreateTrigger()
local buttonData = {}
TriggerAddAction(buttonTrigger, function()
CreateUnit(GetTriggerPlayer(), buttonData[BlzGetTriggerFrame()], 0, 0, 0)
end)
local prevFrame, button, icon, text, unitId
unitId = FourCC("Hpal")
button = BlzCreateFrameByType("BUTTON", "", parent, "IconButtonTemplate", 0)
icon = BlzCreateFrameByType("BACKDROP", "", button, "", 0)
text = BlzCreateFrameByType("TEXT", "", button, "", 0)
buttonData[button] = unitId
BlzTriggerRegisterFrameEvent(buttonTrigger, button, FRAMEEVENT_CONTROL_CLICK)
BlzFrameSetEnable(text, false)
BlzFrameSetSize(button, 0.2, 0.05)
BlzFrameSetSize(icon, 0.04, 0.04)
BlzFrameSetPoint(icon, FRAMEPOINT_LEFT, button, FRAMEPOINT_LEFT, 0.01, 0)
BlzFrameSetPoint(text, FRAMEPOINT_LEFT, icon, FRAMEPOINT_RIGHT, 0.01, 0)
BlzFrameSetPoint(text, FRAMEPOINT_RIGHT, button, FRAMEPOINT_RIGHT, 0, 0)
BlzFrameSetTexture(icon, BlzGetAbilityIcon(unitId), 0, false)
BlzFrameSetText(text, GetObjectName(unitId))
BlzFrameSetPoint(button, FRAMEPOINT_TOP, parent, FRAMEPOINT_TOP, 0, 0)
prevFrame = button
unitId = FourCC("Hamg")
button = BlzCreateFrameByType("BUTTON", "", parent, "IconButtonTemplate", 0)
icon = BlzCreateFrameByType("BACKDROP", "", button, "", 0)
text = BlzCreateFrameByType("TEXT", "", button, "", 0)
buttonData[button] = unitId
BlzTriggerRegisterFrameEvent(buttonTrigger, button, FRAMEEVENT_CONTROL_CLICK)
BlzFrameSetEnable(text, false)
BlzFrameSetSize(button, 0.2, 0.05)
BlzFrameSetSize(icon, 0.04, 0.04)
BlzFrameSetPoint(icon, FRAMEPOINT_LEFT, button, FRAMEPOINT_LEFT, 0.01, 0)
BlzFrameSetPoint(text, FRAMEPOINT_LEFT, icon, FRAMEPOINT_RIGHT, 0.01, 0)
BlzFrameSetPoint(text, FRAMEPOINT_RIGHT, button, FRAMEPOINT_RIGHT, 0, 0)
BlzFrameSetTexture(icon, BlzGetAbilityIcon(unitId), 0, false)
BlzFrameSetText(text, GetObjectName(unitId))
BlzFrameSetPoint(button, FRAMEPOINT_TOP, prevFrame, FRAMEPOINT_BOTTOM, 0, 0)
prevFrame = button
unitId = FourCC("Hmkg")
button = BlzCreateFrameByType("BUTTON", "", parent, "IconButtonTemplate", 0)
icon = BlzCreateFrameByType("BACKDROP", "", button, "", 0)
text = BlzCreateFrameByType("TEXT", "", button, "", 0)
buttonData[button] = unitId
BlzTriggerRegisterFrameEvent(buttonTrigger, button, FRAMEEVENT_CONTROL_CLICK)
BlzFrameSetEnable(text, false)
BlzFrameSetSize(button, 0.2, 0.05)
BlzFrameSetSize(icon, 0.04, 0.04)
BlzFrameSetPoint(icon, FRAMEPOINT_LEFT, button, FRAMEPOINT_LEFT, 0.01, 0)
BlzFrameSetPoint(text, FRAMEPOINT_LEFT, icon, FRAMEPOINT_RIGHT, 0.01, 0)
BlzFrameSetPoint(text, FRAMEPOINT_RIGHT, button, FRAMEPOINT_RIGHT, 0, 0)
BlzFrameSetTexture(icon, BlzGetAbilityIcon(unitId), 0, false)
BlzFrameSetText(text, GetObjectName(unitId))
BlzFrameSetPoint(button, FRAMEPOINT_TOP, prevFrame, FRAMEPOINT_BOTTOM, 0, 0)
prevFrame = button
unitId = FourCC("Hblm")
button = BlzCreateFrameByType("BUTTON", "", parent, "IconButtonTemplate", 0)
icon = BlzCreateFrameByType("BACKDROP", "", button, "", 0)
text = BlzCreateFrameByType("TEXT", "", button, "", 0)
buttonData[button] = unitId
BlzTriggerRegisterFrameEvent(buttonTrigger, button, FRAMEEVENT_CONTROL_CLICK)
BlzFrameSetEnable(text, false)
BlzFrameSetSize(button, 0.2, 0.05)
BlzFrameSetSize(icon, 0.04, 0.04)
BlzFrameSetPoint(icon, FRAMEPOINT_LEFT, button, FRAMEPOINT_LEFT, 0.01, 0)
BlzFrameSetPoint(text, FRAMEPOINT_LEFT, icon, FRAMEPOINT_RIGHT, 0.01, 0)
BlzFrameSetPoint(text, FRAMEPOINT_RIGHT, button, FRAMEPOINT_RIGHT, 0, 0)
BlzFrameSetTexture(icon, BlzGetAbilityIcon(unitId), 0, false)
BlzFrameSetText(text, GetObjectName(unitId))
BlzFrameSetPoint(button, FRAMEPOINT_TOP, prevFrame, FRAMEPOINT_BOTTOM, 0, 0)
prevFrame = button
unitId = FourCC("Hvwd")
button = BlzCreateFrameByType("BUTTON", "", parent, "IconButtonTemplate", 0)
icon = BlzCreateFrameByType("BACKDROP", "", button, "", 0)
text = BlzCreateFrameByType("TEXT", "", button, "", 0)
buttonData[button] = unitId
BlzTriggerRegisterFrameEvent(buttonTrigger, button, FRAMEEVENT_CONTROL_CLICK)
BlzFrameSetEnable(text, false)
BlzFrameSetSize(button, 0.2, 0.05)
BlzFrameSetSize(icon, 0.04, 0.04)
BlzFrameSetPoint(icon, FRAMEPOINT_LEFT, button, FRAMEPOINT_LEFT, 0.01, 0)
BlzFrameSetPoint(text, FRAMEPOINT_LEFT, icon, FRAMEPOINT_RIGHT, 0.01, 0)
BlzFrameSetPoint(text, FRAMEPOINT_RIGHT, button, FRAMEPOINT_RIGHT, 0, 0)
BlzFrameSetTexture(icon, BlzGetAbilityIcon(unitId), 0, false)
BlzFrameSetText(text, GetObjectName(unitId))
BlzFrameSetPoint(button, FRAMEPOINT_TOP, prevFrame, FRAMEPOINT_BOTTOM, 0, 0)
prevFrame = button
unitId = FourCC("Hjai")
button = BlzCreateFrameByType("BUTTON", "", parent, "IconButtonTemplate", 0)
icon = BlzCreateFrameByType("BACKDROP", "", button, "", 0)
text = BlzCreateFrameByType("TEXT", "", button, "", 0)
buttonData[button] = unitId
BlzTriggerRegisterFrameEvent(buttonTrigger, button, FRAMEEVENT_CONTROL_CLICK)
BlzFrameSetEnable(text, false)
BlzFrameSetSize(button, 0.2, 0.05)
BlzFrameSetSize(icon, 0.04, 0.04)
BlzFrameSetPoint(icon, FRAMEPOINT_LEFT, button, FRAMEPOINT_LEFT, 0.01, 0)
BlzFrameSetPoint(text, FRAMEPOINT_LEFT, icon, FRAMEPOINT_RIGHT, 0.01, 0)
BlzFrameSetPoint(text, FRAMEPOINT_RIGHT, button, FRAMEPOINT_RIGHT, 0, 0)
BlzFrameSetTexture(icon, BlzGetAbilityIcon(unitId), 0, false)
BlzFrameSetText(text, GetObjectName(unitId))
BlzFrameSetPoint(button, FRAMEPOINT_TOP, prevFrame, FRAMEPOINT_BOTTOM, 0, 0)
prevFrame = button
-- Page 3 Content
parent = containerFramePage3
local editBox1, editBox2, result, editboxTrigger
editBox1 = BlzCreateFrameByType("EDITBOX", "", parent, "EscMenuEditBoxTemplate", 0)
editBox2 = BlzCreateFrameByType("EDITBOX", "", parent, "EscMenuEditBoxTemplate", 0)
result = BlzCreateFrameByType("TEXT", "", parent, "", 0)
BlzFrameSetText(result, "Result")
BlzFrameSetScale(result, 1.4)
BlzFrameSetSize(editBox1, 0.1, 0.04)
BlzFrameSetSize(editBox2, 0.1, 0.04)
BlzFrameSetPoint(editBox1, FRAMEPOINT_TOPLEFT, parent, FRAMEPOINT_TOPLEFT, 0, 0)
BlzFrameSetPoint(editBox2, FRAMEPOINT_TOPLEFT, editBox1, FRAMEPOINT_TOPRIGHT, 0, 0)
BlzFrameSetPoint(result, FRAMEPOINT_BOTTOM, parent, FRAMEPOINT_BOTTOM, 0, 0)
button = BlzCreateFrameByType("GLUETEXTBUTTON", "", parent, "ScriptDialogButton", 0)
BlzFrameSetSize(button, 0.03, 0.03)
BlzFrameSetText(button, "+")
BlzFrameSetPoint(button, FRAMEPOINT_LEFT, parent, FRAMEPOINT_LEFT, 0, 0)
editboxTrigger = CreateTrigger()
BlzTriggerRegisterFrameEvent(editboxTrigger, button, FRAMEEVENT_CONTROL_CLICK)
TriggerAddAction(editboxTrigger, function()
BlzFrameSetText(result, (tonumber(BlzFrameGetText(editBox1)) + tonumber(BlzFrameGetText(editBox2))))
end)
prevFrame = button
button = BlzCreateFrameByType("GLUETEXTBUTTON", "", parent, "ScriptDialogButton", 0)
BlzFrameSetSize(button, 0.03, 0.03)
BlzFrameSetText(button, "-")
BlzFrameSetPoint(button, FRAMEPOINT_LEFT, prevFrame, FRAMEPOINT_RIGHT, 0, 0)
editboxTrigger = CreateTrigger()
BlzTriggerRegisterFrameEvent(editboxTrigger, button, FRAMEEVENT_CONTROL_CLICK)
TriggerAddAction(editboxTrigger, function()
BlzFrameSetText(result, (tonumber(BlzFrameGetText(editBox1)) - tonumber(BlzFrameGetText(editBox2))))
end)
prevFrame = button
button = BlzCreateFrameByType("GLUETEXTBUTTON", "", parent, "ScriptDialogButton", 0)
BlzFrameSetSize(button, 0.03, 0.03)
BlzFrameSetText(button, "*")
BlzFrameSetPoint(button, FRAMEPOINT_LEFT, prevFrame, FRAMEPOINT_RIGHT, 0, 0)
editboxTrigger = CreateTrigger()
BlzTriggerRegisterFrameEvent(editboxTrigger, button, FRAMEEVENT_CONTROL_CLICK)
TriggerAddAction(editboxTrigger, function()
BlzFrameSetText(result, (tonumber(BlzFrameGetText(editBox1)) * tonumber(BlzFrameGetText(editBox2))))
end)
prevFrame = button
button = BlzCreateFrameByType("GLUETEXTBUTTON", "", parent, "ScriptDialogButton", 0)
BlzFrameSetSize(button, 0.03, 0.03)
BlzFrameSetText(button, "/")
BlzFrameSetPoint(button, FRAMEPOINT_LEFT, prevFrame, FRAMEPOINT_RIGHT, 0, 0)
editboxTrigger = CreateTrigger()
BlzTriggerRegisterFrameEvent(editboxTrigger, button, FRAMEEVENT_CONTROL_CLICK)
TriggerAddAction(editboxTrigger, function()
BlzFrameSetText(result, (tonumber(BlzFrameGetText(editBox1)) / tonumber(BlzFrameGetText(editBox2))))
end)
prevFrame = button
print("done")
end
end