Below is working code to embed Mozilla in c# Windows Forms.  (I've
made it as simple as possible for posting)It compiles and embeds the
Mozilla control fine except that text boxes can not be edited...most
of the time...

This sample navigates to Google Language Tools, for example, which
contains a combination of textboxes and a textarea.  The textarea can
be edited however the textboxes cannot even be selected for editing. 
This behavior seems constant for any webpage however what's most
interesting is that after any post/form submission the behavior goes
away.

This is almost workable for me however I require the embedded browser
to work with HTML WYSIWYG editing such as TinyMCE (commented below)
and I've found absolutely no way to get that to work embedded and I
know it works with the standalone Mozilla.

Another interesting point is that the initial page can be set via
javascript within the page itself to force focus to a textbox and that
will work until the textbox losses focus and then it can't gain focus
again (i.e. document.form1.textbox1.focus())  If you set the initial
start page in the source to http://www.google.com homepage you should
see what I mean.

Am I missing something or is this a bug.  A fix or work-around would
be great.  In my case a fix from the c# side or html side would be
sufficient seeing as it will only be browsing pages intended for that
embedded browser.

There are other completely unanswered posts elsewhere for this exact
problem, I hope this doesn't turn into another unanswered post... :(

-------------------------------------

using System;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
        
using AxMOZILLACONTROLLib;

namespace MyNamespace
{
        public class MainForm : System.Windows.Forms.Form
        {
                private AxMozillaBrowser WebBrowser;

                public MainForm()
                {
            this.WebBrowser = new AxMozillaBrowser();
            /////////////// Suspend and Begin /////////////
            this.SuspendLayout();
                        
/////////////////////////////////////////////////////////////
            this.WebBrowser.BeginInit();
            this.WebBrowser.Dock = DockStyle.Fill;
            this.Controls.Add(this.WebBrowser);
            this.WebBrowser.EndInit();
                        
/////////////////////////////////////////////////////////////
            this.Text = "TestBrowser";
            this.Name = "TestBrowser";
            this.Font = new Font("Tahoma", 8);
                        this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
                        this.ClientSize = new System.Drawing.Size(550, 400);
                        this.MinimumSize = new System.Drawing.Size(550, 400);
                        this.WindowState = FormWindowState.Maximized;
                        
/////////////////////////////////////////////////////////////
            this.ResumeLayout(false);

            try {
                                System.Object flagObject = 0;
                                System.Object targObject = 0;
                                System.Object postObject = 0;
                                System.Object headerObject = 0;
                                //string url = 
"http://tinymce.moxiecode.com/examples/example_simple.htm";;
                                string url = 
"http://www.google.com/language_tools";;
                                WebBrowser.Navigate(url,ref flagObject,ref 
targObject,ref
postObject,ref headerObject);
            }
            catch (COMException e)
            {
                MessageBox.Show ( e.ToString() );
            }
                }
                
                /// The main entry point for the application.
                [STAThread]
                public static void Main() 
                {
                        Application.Run(new MainForm());
                }
        }
}
_______________________________________________
mozilla-embedding mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-embedding

Reply via email to