Browse Source

Enhance Editor to warn user actions that can potentially lose data.

Also:
- Change how the UIElement::GetNumChildren() method is being exposed to scripting to avoid confusion with "numChildren" getter.
- Make Button element focusable. Focused button accepts enter key or space key as click. TODO: to visually show focused button differently than non-focused ones.
- Fix MessageBox dialog window centering issue.
Yao Wei Tjong 姚伟忠 12 years ago
parent
commit
92cb20e9f5

+ 24 - 2
Bin/Data/Scripts/Editor/EditorScene.as

@@ -64,6 +64,19 @@ bool ResetScene()
 {
 {
     ui.cursor.shape = CS_BUSY;
     ui.cursor.shape = CS_BUSY;
 
 
+    if (messageBoxCallback is null && sceneModified)
+    {
+        uiMessageBox = MessageBox("Scene has been modified.\nContinue to reset?", "Warning");
+        Button@ cancelButton = uiMessageBox.window.GetChild("CancelButton", true);
+        cancelButton.visible = true;
+        cancelButton.focus = true;
+        SubscribeToEvent(uiMessageBox, "MessageACK", "HandleMessageAcknowledgement");
+        messageBoxCallback = @ResetScene;
+        return false;
+    }
+    else
+        messageBoxCallback = null;
+
     suppressSceneChanges = true;
     suppressSceneChanges = true;
 
 
     // Create a scene with default values, these will be overridden when loading scenes
     // Create a scene with default values, these will be overridden when loading scenes
@@ -146,13 +159,16 @@ bool LoadScene(const String&in fileName)
     // Always load the scene from the filesystem, not from resource paths
     // Always load the scene from the filesystem, not from resource paths
     if (!fileSystem.FileExists(fileName))
     if (!fileSystem.FileExists(fileName))
     {
     {
-        log.Error("No such scene: " + fileName);
+        MessageBox("No such scene.\n" + fileName);
         return false;
         return false;
     }
     }
 
 
     File file(fileName, FILE_READ);
     File file(fileName, FILE_READ);
     if (!file.open)
     if (!file.open)
+    {
+        MessageBox("Could not open file.\n" + fileName);
         return false;
         return false;
+    }
 
 
     // Add the scene's resource path in case it's necessary
     // Add the scene's resource path in case it's necessary
     String newScenePath = GetPath(fileName);
     String newScenePath = GetPath(fileName);
@@ -279,13 +295,16 @@ void LoadNode(const String&in fileName)
 
 
     if (!fileSystem.FileExists(fileName))
     if (!fileSystem.FileExists(fileName))
     {
     {
-        log.Error("No such node file " + fileName);
+        MessageBox("No such node file.\n" + fileName);
         return;
         return;
     }
     }
 
 
     File file(fileName, FILE_READ);
     File file(fileName, FILE_READ);
     if (!file.open)
     if (!file.open)
+    {
+        MessageBox("Could not open file.\n" + fileName);
         return;
         return;
+    }
 
 
     ui.cursor.shape = CS_BUSY;
     ui.cursor.shape = CS_BUSY;
 
 
@@ -323,7 +342,10 @@ bool SaveNode(const String&in fileName)
 
 
     File file(fileName, FILE_WRITE);
     File file(fileName, FILE_WRITE);
     if (!file.open)
     if (!file.open)
+    {
+        MessageBox("Could not open file.\n" + fileName);
         return false;
         return false;
+    }
 
 
     String extension = GetExtension(fileName);
     String extension = GetExtension(fileName);
     bool success = (extension != ".xml" ? editNode.Save(file) : editNode.SaveXML(file));
     bool success = (extension != ".xml" ? editNode.Save(file) : editNode.SaveXML(file));

+ 45 - 0
Bin/Data/Scripts/Editor/EditorUI.as

@@ -6,6 +6,7 @@ UIElement@ uiMenuBar;
 UIElement@ quickMenu;
 UIElement@ quickMenu;
 Array<QuickMenuItem@> quickMenuItems;
 Array<QuickMenuItem@> quickMenuItems;
 FileSelector@ uiFileSelector;
 FileSelector@ uiFileSelector;
+MessageBox@ uiMessageBox;
 
 
 const ShortStringHash UI_ELEMENT_TYPE("UIElement");
 const ShortStringHash UI_ELEMENT_TYPE("UIElement");
 const ShortStringHash WINDOW_TYPE("Window");
 const ShortStringHash WINDOW_TYPE("Window");
@@ -136,6 +137,7 @@ void CreateCursor()
 // AngelScript does not support closures (yet), but funcdef should do just fine as a workaround for a few cases here for now
 // AngelScript does not support closures (yet), but funcdef should do just fine as a workaround for a few cases here for now
 funcdef bool MENU_CALLBACK();
 funcdef bool MENU_CALLBACK();
 Array<MENU_CALLBACK@> menuCallbacks;
 Array<MENU_CALLBACK@> menuCallbacks;
+MENU_CALLBACK@ messageBoxCallback;
 
 
 void HandleQuickSearchChange(StringHash eventType, VariantMap& eventData)
 void HandleQuickSearchChange(StringHash eventType, VariantMap& eventData)
 {
 {
@@ -421,6 +423,40 @@ void CreateMenuBar()
 
 
 bool Exit()
 bool Exit()
 {
 {
+    ui.cursor.shape = CS_BUSY;
+
+    if (messageBoxCallback is null)
+    {
+        String message;
+        if (sceneModified)
+            message = "Scene has been modified.\n";
+
+        bool uiLayoutModified = false;
+        for (uint i = 0; i < editorUIElement.numChildren; ++i)
+        {
+            UIElement@ element = editorUIElement.children[i];
+            if (element !is null && element.vars[MODIFIED_VAR].GetBool())
+            {
+                uiLayoutModified = true;
+                message += "UI layout has been modified.\n";
+                break;
+            }
+        }
+
+        if (sceneModified || uiLayoutModified)
+        {
+            uiMessageBox = MessageBox(message + "Continue to exit?", "Warning");
+            Button@ cancelButton = uiMessageBox.window.GetChild("CancelButton", true);
+            cancelButton.visible = true;
+            cancelButton.focus = true;
+            SubscribeToEvent(uiMessageBox, "MessageACK", "HandleMessageAcknowledgement");
+            messageBoxCallback = @Exit;
+            return false;
+        }
+    }
+    else
+        messageBoxCallback = null;
+
     engine.Exit();
     engine.Exit();
     return true;
     return true;
 }
 }
@@ -1296,3 +1332,12 @@ void UpdateDirtyUI()
     if (attributesFullDirty || attributesDirty)
     if (attributesFullDirty || attributesDirty)
         UpdateAttributeInspector(attributesFullDirty);
         UpdateAttributeInspector(attributesFullDirty);
 }
 }
+
+void HandleMessageAcknowledgement(StringHash eventType, VariantMap& eventData)
+{
+    uiMessageBox = null;
+    if (eventData["Ok"].GetBool())
+        messageBoxCallback();
+    else
+        messageBoxCallback = null;
+}

+ 61 - 5
Bin/Data/Scripts/Editor/EditorUIElement.as

@@ -1,5 +1,4 @@
 // Urho3D editor UI-element handling
 // Urho3D editor UI-element handling
-
 UIElement@ editorUIElement;
 UIElement@ editorUIElement;
 XMLFile@ uiElementDefaultStyle;
 XMLFile@ uiElementDefaultStyle;
 Array<String> availableStyles;
 Array<String> availableStyles;
@@ -99,20 +98,23 @@ void OpenUILayout(const String&in fileName)
     // Check if the UI element has been opened before
     // Check if the UI element has been opened before
     if (editorUIElement.GetChild(FILENAME_VAR, Variant(fileName)) !is null)
     if (editorUIElement.GetChild(FILENAME_VAR, Variant(fileName)) !is null)
     {
     {
-        log.Warning("UI element is already opened: " + fileName);
+        MessageBox("UI element is already opened.\n" + fileName);
         return;
         return;
     }
     }
 
 
     // Always load from the filesystem, not from resource paths
     // Always load from the filesystem, not from resource paths
     if (!fileSystem.FileExists(fileName))
     if (!fileSystem.FileExists(fileName))
     {
     {
-        log.Error("No such file: " + fileName);
+        MessageBox("No such file.\n" + fileName);
         return;
         return;
     }
     }
 
 
     File file(fileName, FILE_READ);
     File file(fileName, FILE_READ);
     if (!file.open)
     if (!file.open)
+    {
+        MessageBox("Could not open file.\n" + fileName);
         return;
         return;
+    }
 
 
     // Add the UI layout's resource path in case it's necessary
     // Add the UI layout's resource path in case it's necessary
     SetResourcePath(GetPath(fileName), true, true);
     SetResourcePath(GetPath(fileName), true, true);
@@ -141,6 +143,8 @@ void OpenUILayout(const String&in fileName)
 
 
         ClearEditActions();
         ClearEditActions();
     }
     }
+    else
+        MessageBox("Could not load UI layout successfully!\nSee Urho3D.log for more detail.");
 
 
     suppressUIElementChanges = false;
     suppressUIElementChanges = false;
 }
 }
@@ -149,6 +153,26 @@ bool CloseUILayout()
 {
 {
     ui.cursor.shape = CS_BUSY;
     ui.cursor.shape = CS_BUSY;
 
 
+    if (messageBoxCallback is null)
+    {
+        for (uint i = 0; i < selectedUIElements.length; ++i)
+        {
+            UIElement@ element = GetTopLevelUIElement(selectedUIElements[i]);
+            if (element !is null && element.vars[MODIFIED_VAR].GetBool())
+            {
+                uiMessageBox = MessageBox("UI layout has been modified.\nContinue to close?", "Warning");
+                Button@ cancelButton = uiMessageBox.window.GetChild("CancelButton", true);
+                cancelButton.visible = true;
+                cancelButton.focus = true;
+                SubscribeToEvent(uiMessageBox, "MessageACK", "HandleMessageAcknowledgement");
+                messageBoxCallback = @CloseUILayout;
+                return false;
+            }
+        }
+    }
+    else
+        messageBoxCallback = null;
+
     suppressUIElementChanges = true;
     suppressUIElementChanges = true;
 
 
     for (uint i = 0; i < selectedUIElements.length; ++i)
     for (uint i = 0; i < selectedUIElements.length; ++i)
@@ -172,6 +196,26 @@ bool CloseAllUILayouts()
 {
 {
     ui.cursor.shape = CS_BUSY;
     ui.cursor.shape = CS_BUSY;
 
 
+    if (messageBoxCallback is null)
+    {
+        for (uint i = 0; i < editorUIElement.numChildren; ++i)
+        {
+            UIElement@ element = editorUIElement.children[i];
+            if (element !is null && element.vars[MODIFIED_VAR].GetBool())
+            {
+                uiMessageBox = MessageBox("UI layout has been modified.\nContinue to close?", "Warning");
+                Button@ cancelButton = uiMessageBox.window.GetChild("CancelButton", true);
+                cancelButton.visible = true;
+                cancelButton.focus = true;
+                SubscribeToEvent(uiMessageBox, "MessageACK", "HandleMessageAcknowledgement");
+                messageBoxCallback = @CloseAllUILayouts;
+                return false;
+            }
+        }
+    }
+    else
+        messageBoxCallback = null;
+
     suppressUIElementChanges = true;
     suppressUIElementChanges = true;
 
 
     editorUIElement.RemoveAllChildren();
     editorUIElement.RemoveAllChildren();
@@ -197,7 +241,10 @@ bool SaveUILayout(const String&in fileName)
 
 
     File file(fileName, FILE_WRITE);
     File file(fileName, FILE_WRITE);
     if (!file.open)
     if (!file.open)
+    {
+        MessageBox("Could not open file.\n" + fileName);
         return false;
         return false;
+    }
 
 
     UIElement@ element = GetTopLevelUIElement(editUIElement);
     UIElement@ element = GetTopLevelUIElement(editUIElement);
     if (element is null)
     if (element is null)
@@ -246,13 +293,16 @@ void LoadChildUIElement(const String&in fileName)
 
 
     if (!fileSystem.FileExists(fileName))
     if (!fileSystem.FileExists(fileName))
     {
     {
-        log.Error("No such file: " + fileName);
+        MessageBox("No such file.\n" + fileName);
         return;
         return;
     }
     }
 
 
     File file(fileName, FILE_READ);
     File file(fileName, FILE_READ);
     if (!file.open)
     if (!file.open)
+    {
+        MessageBox("Could not open file.\n" + fileName);
         return;
         return;
+    }
 
 
     XMLFile@ xmlFile = XMLFile();
     XMLFile@ xmlFile = XMLFile();
     xmlFile.Load(file);
     xmlFile.Load(file);
@@ -294,7 +344,10 @@ bool SaveChildUIElement(const String&in fileName)
 
 
     File file(fileName, FILE_WRITE);
     File file(fileName, FILE_WRITE);
     if (!file.open)
     if (!file.open)
+    {
+        MessageBox("Could not open file.\n" + fileName);
         return false;
         return false;
+    }
 
 
     XMLFile@ elementData = XMLFile();
     XMLFile@ elementData = XMLFile();
     XMLElement rootElem = elementData.CreateRoot("element");
     XMLElement rootElem = elementData.CreateRoot("element");
@@ -322,13 +375,16 @@ void SetUIElementDefaultStyle(const String&in fileName)
     // Always load from the filesystem, not from resource paths
     // Always load from the filesystem, not from resource paths
     if (!fileSystem.FileExists(fileName))
     if (!fileSystem.FileExists(fileName))
     {
     {
-        log.Error("No such file: " + fileName);
+        MessageBox("No such file.\n" + fileName);
         return;
         return;
     }
     }
 
 
     File file(fileName, FILE_READ);
     File file(fileName, FILE_READ);
     if (!file.open)
     if (!file.open)
+    {
+        MessageBox("Could not open file.\n" + fileName);
         return;
         return;
+    }
 
 
     uiElementDefaultStyle = XMLFile();
     uiElementDefaultStyle = XMLFile();
     uiElementDefaultStyle.Load(file);
     uiElementDefaultStyle.Load(file);

+ 17 - 4
Bin/Data/UI/MessageBox.xml

@@ -2,18 +2,18 @@
 <element type="Window" style="DialogWindow">
 <element type="Window" style="DialogWindow">
 	<attribute name="Name" value="MessageBox" />
 	<attribute name="Name" value="MessageBox" />
 	<attribute name="Position" value="500 500" />
 	<attribute name="Position" value="500 500" />
-	<attribute name="Min Size" value="400 83" />
+	<attribute name="Size" value="400 83" />
 	<attribute name="Layout Mode" value="Vertical" />
 	<attribute name="Layout Mode" value="Vertical" />
 	<attribute name="Layout Spacing" value="4" />
 	<attribute name="Layout Spacing" value="4" />
 	<attribute name="Layout Border" value="6 6 6 6" />
 	<attribute name="Layout Border" value="6 6 6 6" />
 	<attribute name="Resize Border" value="6 6 6 6" />
 	<attribute name="Resize Border" value="6 6 6 6" />
 	<element>
 	<element>
-		<attribute name="Min Size" value="0 16" />
+		<attribute name="Min Size" value="64 16" />
 		<attribute name="Max Size" value="2147483647 16" />
 		<attribute name="Max Size" value="2147483647 16" />
 		<attribute name="Layout Mode" value="Horizontal" />
 		<attribute name="Layout Mode" value="Horizontal" />
 		<element type="Text">
 		<element type="Text">
 			<attribute name="Name" value="TitleText" />
 			<attribute name="Name" value="TitleText" />
-			<attribute name="Text" value="Urho3D" />
+			<attribute name="Text" value="Error" />
 		</element>
 		</element>
 		<element type="Button" style="CloseButton">
 		<element type="Button" style="CloseButton">
 			<attribute name="Name" value="CloseButton" />
 			<attribute name="Name" value="CloseButton" />
@@ -30,10 +30,23 @@
 		</element>
 		</element>
 	</element>
 	</element>
 	<element>
 	<element>
-		<attribute name="Min Size" value="0 17" />
+		<attribute name="Min Size" value="74 17" />
 		<attribute name="Max Size" value="2147483647 17" />
 		<attribute name="Max Size" value="2147483647 17" />
 		<attribute name="Layout Mode" value="Horizontal" />
 		<attribute name="Layout Mode" value="Horizontal" />
+		<attribute name="Layout Spacing" value="4" />
 		<element />
 		<element />
+		<element type="Button">
+			<attribute name="Name" value="CancelButton" />
+			<attribute name="Min Size" value="70 17" />
+			<attribute name="Max Size" value="70 17" />
+			<attribute name="Is Visible" value="false" />
+			<attribute name="Layout Mode" value="Horizontal" />
+			<attribute name="Layout Border" value="1 1 1 1" />
+			<element type="Text">
+				<attribute name="Text" value="Cancel" />
+				<attribute name="Text Alignment" value="Center" />
+			</element>
+		</element>
 		<element type="Button">
 		<element type="Button">
 			<attribute name="Name" value="OkButton" />
 			<attribute name="Name" value="OkButton" />
 			<attribute name="Min Size" value="70 17" />
 			<attribute name="Min Size" value="70 17" />

+ 0 - 5
Source/Engine/Core/Context.cpp

@@ -234,9 +234,4 @@ void Context::RemoveEventReceiver(Object* receiver, Object* sender, StringHash e
         group->Erase(receiver);
         group->Erase(receiver);
 }
 }
 
 
-void Context::EndSendEvent()
-{
-    eventSenders_.Pop();
-}
-
 }
 }

+ 1 - 1
Source/Engine/Core/Context.h

@@ -145,7 +145,7 @@ private:
     /// Begin event send.
     /// Begin event send.
     void BeginSendEvent(Object* sender) { eventSenders_.Push(sender); }
     void BeginSendEvent(Object* sender) { eventSenders_.Push(sender); }
     /// End event send. Clean up event receivers removed in the meanwhile.
     /// End event send. Clean up event receivers removed in the meanwhile.
-    void EndSendEvent();
+    void EndSendEvent() { eventSenders_.Pop(); }
 
 
     /// Object factories.
     /// Object factories.
     HashMap<ShortStringHash, SharedPtr<ObjectFactory> > factories_;
     HashMap<ShortStringHash, SharedPtr<ObjectFactory> > factories_;

+ 1 - 1
Source/Engine/Script/APITemplates.h

@@ -1036,7 +1036,7 @@ template <class T> void RegisterUIElement(asIScriptEngine* engine, const char* c
     engine->RegisterObjectMethod(className, "bool get_elementEventSender() const", asMETHOD(T, IsElementEventSender), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "bool get_elementEventSender() const", asMETHOD(T, IsElementEventSender), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "uint get_numChildren() const", asFUNCTION(UIElementGetNumChildrenNonRecursive), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod(className, "uint get_numChildren() const", asFUNCTION(UIElementGetNumChildrenNonRecursive), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod(className, "uint get_numAllChildren() const", asFUNCTION(UIElementGetNumChildrenRecursive), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod(className, "uint get_numAllChildren() const", asFUNCTION(UIElementGetNumChildrenRecursive), asCALL_CDECL_OBJLAST);
-    engine->RegisterObjectMethod(className, "uint get_numChildren(bool) const", asMETHOD(T, GetNumChildren), asCALL_THISCALL);
+    engine->RegisterObjectMethod(className, "uint GetNumChildren(bool) const", asMETHOD(T, GetNumChildren), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "UIElement@+ get_children(uint) const", asMETHODPR(T, GetChild, (unsigned) const, UIElement*), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "UIElement@+ get_children(uint) const", asMETHODPR(T, GetChild, (unsigned) const, UIElement*), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "void set_parent(UIElement@+)", asFUNCTION(UIElementSetParent), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod(className, "void set_parent(UIElement@+)", asFUNCTION(UIElementSetParent), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod(className, "UIElement@+ get_parent() const", asMETHOD(T, GetParent), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "UIElement@+ get_parent() const", asMETHOD(T, GetParent), asCALL_THISCALL);

+ 13 - 0
Source/Engine/UI/Button.cpp

@@ -24,6 +24,7 @@
 #include "Button.h"
 #include "Button.h"
 #include "Context.h"
 #include "Context.h"
 #include "InputEvents.h"
 #include "InputEvents.h"
+#include "UI.h"
 #include "UIEvents.h"
 #include "UIEvents.h"
 
 
 #include "DebugNew.h"
 #include "DebugNew.h"
@@ -43,6 +44,7 @@ Button::Button(Context* context) :
     pressed_(false)
     pressed_(false)
 {
 {
     enabled_ = true;
     enabled_ = true;
+    focusMode_ = FM_FOCUSABLE;
 }
 }
 
 
 Button::~Button()
 Button::~Button()
@@ -129,6 +131,17 @@ void Button::OnDragMove(const IntVector2& position, const IntVector2& screenPosi
     SetPressed(true);
     SetPressed(true);
 }
 }
 
 
+void Button::OnKey(int key, int buttons, int qualifiers)
+{
+    UI* ui = GetSubsystem<UI>();
+    if (ui->GetFocusElement() == this && (key == KEY_RETURN || key == KEY_RETURN2 || key == KEY_KP_ENTER || key == KEY_SPACE))
+    {
+        // Simulate LMB
+        OnClickBegin(IntVector2(), IntVector2(), MOUSEB_LEFT, 0, 0, 0);
+        OnClickEnd(IntVector2(), IntVector2(), MOUSEB_LEFT, 0, 0, 0, 0);
+    }
+}
+
 void Button::SetPressedOffset(const IntVector2& offset)
 void Button::SetPressedOffset(const IntVector2& offset)
 {
 {
     pressedOffset_ = offset;
     pressedOffset_ = offset;

+ 2 - 0
Source/Engine/UI/Button.h

@@ -50,6 +50,8 @@ public:
     virtual void OnClickEnd(const IntVector2& position, const IntVector2& screenPosition, int button, int buttons, int qualifiers, Cursor* cursor, UIElement* beginElement);
     virtual void OnClickEnd(const IntVector2& position, const IntVector2& screenPosition, int button, int buttons, int qualifiers, Cursor* cursor, UIElement* beginElement);
     /// React to mouse drag motion.
     /// React to mouse drag motion.
     virtual void OnDragMove(const IntVector2& position, const IntVector2& screenPosition, int buttons, int qualifiers, Cursor* cursor);
     virtual void OnDragMove(const IntVector2& position, const IntVector2& screenPosition, int buttons, int qualifiers, Cursor* cursor);
+    /// React to a key press.
+    virtual void OnKey(int key, int buttons, int qualifiers);
 
 
     /// Set offset to image rectangle used when pressed.
     /// Set offset to image rectangle used when pressed.
     void SetPressedOffset(const IntVector2& offset);
     void SetPressedOffset(const IntVector2& offset);

+ 10 - 8
Source/Engine/UI/MessageBox.cpp

@@ -48,6 +48,16 @@ MessageBox::MessageBox(Context* context, const String& messageString, const Stri
     UI* ui = GetSubsystem<UI>();
     UI* ui = GetSubsystem<UI>();
     window_ = ui->LoadLayout(layoutFile, styleFile);
     window_ = ui->LoadLayout(layoutFile, styleFile);
     ui->GetRoot()->AddChild(window_);
     ui->GetRoot()->AddChild(window_);
+
+    // Set the title and message strings if they are given
+    titleText_ = dynamic_cast<Text*>(window_->GetChild("TitleText", true));
+    if (titleText_ && !titleString.Empty())
+        titleText_->SetText(titleString);
+    messageText_ = dynamic_cast<Text*>(window_->GetChild("MessageText", true));
+    if (messageText_ && !messageString.Empty())
+        messageText_->SetText(messageString);
+
+    // Center window after the message is set
     Window* window = dynamic_cast<Window*>(window_.Get());
     Window* window = dynamic_cast<Window*>(window_.Get());
     if (window)
     if (window)
     {
     {
@@ -60,14 +70,6 @@ MessageBox::MessageBox(Context* context, const String& messageString, const Stri
         window->SetModal(true);
         window->SetModal(true);
     }
     }
 
 
-    // Set the title and message strings if they are given
-    titleText_ = dynamic_cast<Text*>(window_->GetChild("TitleText", true));
-    if (titleText_ && !titleString.Empty())
-        titleText_->SetText(titleString);
-    messageText_ = dynamic_cast<Text*>(window_->GetChild("MessageText", true));
-    if (messageText_ && !messageString.Empty())
-        messageText_->SetText(messageString);
-
     // Bind the buttons (if any in the loaded UI layout) to event handlers
     // Bind the buttons (if any in the loaded UI layout) to event handlers
     okButton_ = dynamic_cast<Button*>(window_->GetChild("OkButton", true));
     okButton_ = dynamic_cast<Button*>(window_->GetChild("OkButton", true));
     if (okButton_)
     if (okButton_)