TextBox carret not placed correctly

C

Chien Lau

Hi,

When a user clicks a TextBox on a modal form, the caret immediately
moves to the clicked location within the existing text. On a non-modal form,
the user's TextBox click sets the focus appropriately, but fails to set the
caret. How do I correct this behavior? When the user clicks in the midst of
a word within a TextBox, the caret should be placed precisely between the
two characters at the click-point. Any ideas?

Thanks...
 
C

Chien Lau

Hi,
When a user clicks a TextBox on a modal form, the caret immediately
moves to the clicked location within the existing text. On a non-modal form,
the user's TextBox click sets the focus appropriately, but fails to set the
caret. How do I correct this behavior? When the user clicks in the midst of
a word within a TextBox, the caret should be placed precisely between the
two characters at the click-point. Any ideas?

Not only that, but no text in the TextBox can be selected at ALL via
dragging the mouse. Here's the mind-blowingly weird part.

The problem takes place in a non modal form called CustomerProfileForm.
This non modal form is a child form of the main window. The problem goes
away if the form is created like this:

CustomerProfileForm custForm=new CustomerProfileForm();
custForm.Owner=this;
custForm.Show();

The problem APPEARS if the form is created like this:

CustomerProfileForm custForm=new CustomerProfileForm();
custForm.TopLevel=false;
custForm.Parent=WorkPanel;
custForm.BringToFront();

The obvious solution is: Use the first creation method and avoid the
latter. The problem is: If I use the first creation method, I can't force
the CustomerProfileForm to live within the bounds of the top level window.
I'm stumped.
 

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

Top