public static void MBSetText(GuiMLTextCtrl text, GuiWindowCtrl frame, string msg) { // Get the extent of the text box. Point2I ext = text.getExtent(); // Set the text in the center of the text box. text.setText("<just:center>" + msg); // Force the textbox to resize itself vertically. text.forceReflow(); // Grab the new extent of the text box. Point2I newExtent = text.getExtent(); // Get the vertical change in extent. int deltaY = newExtent.y - ext.y; // Resize the window housing the text box. Point2I windowPos = frame.getPosition(); Point2I windowExt = frame.getExtent(); frame.resize(windowPos.x, (windowPos.y - (deltaY / 2)), windowExt.x, (windowExt.y + deltaY)); frame.canMove = false; frame.resizeWidth = false; frame.resizeHeight = false; frame.canMinimize = false; frame.canMaximize = false; //TODO //omni.Util._sfxPlayOnce("messageBoxBeep"); }
public override void onWake() { // Build the text lists GuiMLTextCtrl WE_LevelList = "WE_LevelList"; GuiMLTextCtrl WE_TemplateList = "WE_TemplateList"; WE_LevelList.clear(); WE_TemplateList.clear(); string leveltext = "<linkcolor:0000FF><linkcolorhl:FF0000>"; string templatetext = "<linkcolor:0000FF><linkcolorhl:FF0000>"; string file = Util.findFirstFile(sGlobal["$Server::MissionFileSpec"], true); while (file != "") { string name = console.Call("getLevelDisplayName", new string[] { file }); string n = name.ToLower(); if (!n.Contains("template")) { leveltext = leveltext + "<a:gamelink:" + file + ">" + name + "</a><br>"; } else { templatetext = templatetext + "<a:gamelink:" + file + ">" + name + "</a><br>"; } file = Util.findNextFile(sGlobal["$Server::MissionFileSpec"]); } WE_LevelList.setText(leveltext); WE_LevelList.forceReflow(); WE_LevelList.scrollToTop(0, 0); WE_TemplateList.setText(templatetext); WE_TemplateList.forceReflow(); WE_TemplateList.scrollToTop(0, 0); }