What exactly does Form.TopLevel = false do?

  • Thread starter Thread starter Uchiha Jax
  • Start date Start date
U

Uchiha Jax

Standard Framework documentation goes into great detail

" A top-level form is a window that has no parent form, or whose parent form
is the desktop window. Top-level windows are typically used as the main form
in an application."

So why is it that standard windows events fail to work in textboxes with
..TopLevel = false forms?

////(inside the load event of a form)

Form f = new Form();
f.TopLevel = false;
this.Controls.Add(f);
f.Show();
TextBox text = new TextBox();
text.Location = new Point(10,10);
text.Size = new Size(100, 20);
f.Controls.Add(text);
text.Text = "Word word word word";

---END--

Then try clicking on the textBox to set the focus just before one of the
letters, it doesn't work.
Entire words are selectable with a double click but single click focus
changes fail.
 
Aha, I was doing this the wrong way.

Form f = new Form();
f.MDIParent = f;
f.Show();
TextBox text = new TextBox();
text.Location = new Point(10,10);
text.Size = new Size(100, 20);
f.Controls.Add(text);
text.Text = "Word word word word";

All sorted now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top