- Joined
- Feb 2, 2006
- Messages
- 1,596
Hi,
from this tutorial I have tried to create a combo box/popupmenu in a custom UI: The Big UI-Frame Tutorial
As far as I understand the tutorial, I have to create a custom FDF file with the popupmenu templates containing all entries.
This is my .toc file imported with the path "war3mapImported\aiplayersTOC.toc":
This is my FDF file imported with the path "UI\FrameDef\UI\aiplayerspopups.fdf":
I have imported the attached .toc file and use the following code:
I am no custom UI expert, so maybe I did something very basic wrong.
from this tutorial I have tried to create a combo box/popupmenu in a custom UI: The Big UI-Frame Tutorial
As far as I understand the tutorial, I have to create a custom FDF file with the popupmenu templates containing all entries.
This is my .toc file imported with the path "war3mapImported\aiplayersTOC.toc":
JASS:
UI\FrameDef\UI\aiplayerspopups.fdf
This is my FDF file imported with the path "UI\FrameDef\UI\aiplayerspopups.fdf":
JASS:
IncludeFile "UI/FrameDef/UI/EscMenuTemplates.fdf",
Frame "POPUPMENU" "MyPopupTemplate" {
Width 0.19625,
Height 0.03,
PopupButtonInset 0.01, // -x offset for PopupArrowFrame from RIGHT of the POPUPMENU
// Background Enabled
ControlBackdrop "MyPopupTemplateBackdropTemplate",
Frame "BACKDROP" "MyPopupTemplateBackdropTemplate" INHERITS "EscMenuButtonBackdropTemplate" {
}
// Background Disabled
ControlDisabledBackdrop "MyPopupTemplateDisabledBackdropTemplate",
Frame "BACKDROP" "MyPopupTemplateDisabledBackdropTemplate" INHERITS "EscMenuButtonDisabledBackdropTemplate" {
}
// Text markup for the current selected Text, also can be used with a FrameEvent to know when someone starts selecting.
PopupTitleFrame "PopupMenuTitleTemplate",
Frame "GLUETEXTBUTTON" "PopupMenuTitleTemplate" INHERITS WITHCHILDREN "EscMenuPopupMenuTitleTemplate" {
}
// the Arrow at the right
PopupArrowFrame "PopupMenuArrowTemplate",
Frame "BUTTON" "PopupMenuArrowTemplate" INHERITS WITHCHILDREN "EscMenuPopupMenuArrowTemplate" {
}
// The Container for the selectable options
// actulay it is smarter to not define this in the Template.
//PopupMenuFrame "TestPopupMenu",
//Frame "MENU" "TestPopupMenu" INHERITS WITHCHILDREN "EscMenuPopupMenuMenuTemplate" {
//
// }
}
Frame "POPUPMENU" "TestPopup" INHERITS WITHCHILDREN "MyPopupTemplate" {
// The Container for the selectable options
PopupMenuFrame "TestPopupMenu",
Frame "MENU" "TestPopupMenu" INHERITS WITHCHILDREN "EscMenuPopupMenuMenuTemplate" {
// the selectable options
// they will try to load a Localized String
MenuItem "Random", -2,
MenuItem "Random Human", -2,
MenuItem "Mountain King", -2,
MenuItem "TestD", -2,
}
}
Frame "POPUPMENU" "HeroesPopup" INHERITS WITHCHILDREN "MyPopupTemplate" {
PopupMenuFrame "HeroesPopupMenu",
Frame "MENU" "HeroesPopupMenu" INHERITS WITHCHILDREN "EscMenuPopupMenuMenuTemplate" {
MenuItem "Random", -2,
MenuItem "Random Human", -2,
MenuItem "Mountain King", -2,
}
}
Frame "EDITBOX" "HeroesEditBox" INHERITS WITHCHILDREN "EscMenuEditBoxTemplate" {
Width 0.15,
Height 0.037,
DecorateFileNames,
FrameFont "MasterFont", 0.015, "",
SetPoint TOPLEFT, "HeroesPopup", TOPRIGHT, 0.0, 0.0,
EditTextFrame "CustomCommandsEditBoxText",
Frame "TEXT" "CustomCommandsEditBoxText" INHERITS "EscMenuEditBoxTextTemplate" {
}
}
Frame "POPUPMENU" "StartLocationsPopup" INHERITS WITHCHILDREN "MyPopupTemplate" {
PopupMenuFrame "StartLocationsPopupMenu",
Frame "MENU" "StartLocationsPopupMenu" INHERITS WITHCHILDREN "EscMenuPopupMenuMenuTemplate" {
MenuItem "Random", -2,
MenuItem "New Stormwind", -2,
MenuItem "Orgrimmar", -2,
}
}
Frame "POPUPMENU" "RacesPopup" INHERITS WITHCHILDREN "MyPopupTemplate" {
PopupMenuFrame "RacesPopupMenu",
Frame "MENU" "RacesPopupMenu" INHERITS WITHCHILDREN "EscMenuPopupMenuMenuTemplate" {
MenuItem "Freelancer", -2,
MenuItem "Random", -2,
MenuItem "Human", -2,
}
}
Frame "POPUPMENU" "ProfessionsPopup" INHERITS WITHCHILDREN "MyPopupTemplate" {
PopupMenuFrame "ProfessionsPopupMenu",
Frame "MENU" "ProfessionsPopupMenu" INHERITS WITHCHILDREN "EscMenuPopupMenuMenuTemplate" {
MenuItem "Random", -2,
MenuItem "Herbalist", -2,
MenuItem "Alchemist", -2,
}
}
I have imported the attached .toc file and use the following code:
JASS:
globals
framehandle array AiPlayersUILabelFrameColumnRaceEdit
endglobals
...
// show the frame to the player
call BlzFrameSetVisible(AiPlayersUILabelFrameColumnRaceEdit[index], visible)
...
call BlzLoadTOCFile("war3mapImported\\aiplayersTOC.toc")
...
set AiPlayersUILabelFrameColumnRaceEdit[index] = BlzCreateFrame("RacesPopup", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0, 0)
call BlzFrameSetAbsPoint(AiPlayersUILabelFrameColumnRaceEdit[index], FRAMEPOINT_TOPLEFT, AI_PLAYERS_UI_COLUMN_RACE_X, y)
call BlzFrameSetAbsPoint(AiPlayersUILabelFrameColumnRaceEdit[index], FRAMEPOINT_BOTTOMRIGHT, AI_PLAYERS_UI_COLUMN_RACE_X + AI_PLAYERS_UI_COLUMN_RACE_WIDTH, y - AI_PLAYERS_UI_LINE_HEADERS_HEIGHT)
call BlzFrameSetEnable(AiPlayersUILabelFrameColumnRaceEdit[index], true)
call BlzFrameSetVisible(AiPlayersUILabelFrameColumnRaceEdit[index], false)
I am no custom UI expert, so maybe I did something very basic wrong.