none
Issue in my Outlook COM Add-in RRS feed

  • Question

  • Hi,

    In the Outlook COM Add-in Project, I've created a Remoting Client Application to get a string from the server Object.

    I've created a custom Toolbar and a msoControlEdit Control and filling the text property from the string i've got from the Remoting Client.

    I've also created a method to display the text in marquee effect using the Timer Object.

    The issue is that, With the help of log message i found that the timer object tick is trigered and the RotateText Method is called but the text is not marquing properly while displaying the text. When i click on the ControlEdit, the text is marquing properly. Also when i give SetFocus to the Control in the timer object, i'm getting the text marqueed properly, but at the cost of usablility, i cannot use outlook, always the ControlEdit Controls get the Focus.


    Could anyone solve the issues?
    Tuesday, November 20, 2007 12:31 PM

Answers

  • Hi,

     

    It results from that the ControlEdit will not refresh itself. Yes, when it gets focus, it will refresh automatically. But in that case, you will not access Outlook as you point out.

    The trick is setting the ControlEdit’s visible property to be true every time you change its text in the Timer. You will find it works OK. Codes test successfully at my side, for your information:

    Code Block

            Timer t = new Timer();

            Office.CommandBarComboBox editor = null;

     

            private void ThisAddIn_Startup(object sender, System.EventArgs e)

            {

                t.Interval = 1000;

                t.Enabled = true;

                t.Tick += new EventHandler(t_Tick);

                Office.CommandBar cb = this.Application.ActiveExplorer().CommandBars.Add("Test",

                    Office.MsoBarPosition.msoBarTop, false, true) as Office.CommandBar;

                cb.Visible = true;

                editor = cb.Controls.Add(Office.MsoControlType.msoControlEdit,

                    missing, missing, missing, true) as Office.CommandBarComboBox;

                editor.Tag = "My Editor Box";

                editor.Caption = "Test";

                editor.Text = "              This is a Test";

            }

     

            void t_Tick(object sender, EventArgs e)

            {

                try

                {

                    editor.Text = editor.Text.Substring(1);

                    editor.Visible = true;

                }

                catch

                {

                    editor.Text = "              This is a Test";

                    editor.Visible = true;

                }

            }

     

     

     

     

    Thanks

    Ji

     

    Thursday, November 22, 2007 12:56 PM
    Moderator