MessageBox button size issue when using custom captions

  1. #1

    MessageBox button size issue when using custom captions

    Hello,

    When I show a MessageBox with custom text in the buttons and then another one with a short text (small buttons), the buttons remain at that size for all following instances of MessageBox and the captions appear incomplete. This is a demo:

    <%@ Page Language="C#" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        [DirectMethod]
        public void Msg1(object sender, DirectEventArgs e)
        {
            ShowMessageBox("Yesss!", "Noooo!");
        }
    
        [DirectMethod]
        public void Msg2(object sender, DirectEventArgs e)
        {
            ShowMessageBox("Y", "N");
        }
    
        private void ShowMessageBox(string yesTest, string noText)
        {
            MessageBoxConfig msgCfg = new MessageBoxConfig();
            msgCfg.Title = "Button width test";
            msgCfg.Message = "Are you sure?";
    
            msgCfg.MessageBoxButtonsConfig = new MessageBoxButtonsConfig();
    
            msgCfg.MessageBoxButtonsConfig.Yes = new MessageBoxButtonConfig();
            msgCfg.MessageBoxButtonsConfig.Yes.Text = yesTest;
    
            msgCfg.MessageBoxButtonsConfig.No = new MessageBoxButtonConfig();
            msgCfg.MessageBoxButtonsConfig.No.Text = noText;
    
            msgCfg.Buttons = MessageBox.Button.YESNO;
            msgCfg.Icon = MessageBox.Icon.QUESTION;
            msgCfg.Closable = false;
    
            X.Msg.Show(msgCfg);
        }
    
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>MessageBox buttons problem</title>
    </head>
    <body>
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <h1>MessageBox buttons problem</h1>
    
        <ext:Button runat="server" ID="Button1" Text="MessageBox 1">
            <DirectEvents>
                <Click OnEvent="Msg1" />
            </DirectEvents>
        </ext:Button>
        <ext:Button runat="server" ID="Button2" Text="MessageBox 2">
            <DirectEvents>
                <Click OnEvent="Msg2" />
            </DirectEvents>
        </ext:Button>
    </body>
    </html>
    Press MessageBox 1, buttons appear ok (large). Press MessageBox 2, buttons appear ok (small). Press MessageBox 1 again, and the buttons remain small and the text is cropped. This happens with versions 1.0 and 1.7.
    Is this a bug? Is there a way to avoid this?

    Thanks and regards,

    Andrew
    Last edited by ALobpreis; May 19, 2014 at 8:39 PM.
  2. #2
    Any ideas on this?

    It seems to me that this error occurs when the text is so sort that the button is not resized from its minimum width.

    Meanwhile, what I did was add "&nbsp;" before and after the short text, forcing it to be "longer", and now it's working ok. These spaces can be noticed by looking at the dotted rectangle when the button has focus, but that's totally acceptable in my case.

Similar Threads

  1. Replies: 1
    Last Post: Apr 03, 2014, 11:30 PM
  2. [CLOSED] MessageBox X-close button listener?
    By vadym.f in forum 1.x Legacy Premium Help
    Replies: 9
    Last Post: Aug 01, 2013, 8:32 AM
  3. [CLOSED] Recent issue with MessageBox
    By edigital in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jan 20, 2011, 11:22 AM
  4. Replies: 3
    Last Post: Sep 10, 2010, 2:07 PM
  5. [CLOSED] MessageBox: stop execution until message box button is clicked
    By RomualdAwessou in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Aug 06, 2010, 2:24 PM

Tags for this Thread

Posting Permissions