• 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!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

[JASS] Custom UI combo box/popupmenu does not work

Status
Not open for further replies.
Level 28
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":
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.
 
This is my .toc file imported with the path "war3mapImported\aiplayersTOC.toc":
JASS:
UI\FrameDef\UI\aiplayerspopups.fdf
Make Sure you have an empty ending line (inside the toc file) like in that image:
toc-empty-line-jpg.367753
 
Level 28
Joined
Feb 2, 2006
Messages
1,596
Hive does not show it properly but there is an empty ending line after the line:

JASS:
UI\FrameDef\UI\aiplayerspopups.fdf
You can download and try the map: https://github.com/tdauth/wowr/raw/master/wowr2.1.w3x
If you start it with additional Computer players there is a dialog for AI settings in the beginning which should show the popupmenus but does show nothing. However, text edits and labels do work.
 
Status
Not open for further replies.
Top