Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 167
  • Last Modified:

Funny behaviour of mouse click...

Hi

This is a simple scenario but I can't figure why it happens and how to solve it:

There are 2 edit boxes in a form, with their Caption set as the original value, ie Edit1 and Edit2. Now, in the OnEnter event of Edit1 (chosen arbitrarily), this code is written
 
  showmessage('enter');

OK, now if we run this program, and first click on Edit2, so far so good. Now, if we click on Edit1, the message comes out, and if we press OK, the focus returns to Edit1. OK, notice that the text is being selected as the mouse moves...

How do prevent this? I don't want the select thing to occur, but instead want the cursor to remain still in the edit box.

My feeling is i have to trap for the mouse event. Any other ideas?

Keith
0
keithcsl
Asked:
keithcsl
1 Solution
 
pjdbCommented:
Change the autoselect to false and the text won't be selected during the onenter event of the Tedit box.

JDB
0
 
keithcslAuthor Commented:
pjdb

sorry but it doesn't work. i have got a small exe file and if u r interested to test it out, that's great..

Keith
0
 
pjdbCommented:
Can u send it to jeanditbailleulp@usa.net , I will take a look

JDB
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
MatveyCommented:
I think that OnEnter is the wrong event - try others like OnMouseUp, or OnClick, just see what you got there...

Good luck!
Matvey
(bosism@netvision.net.il)

PS you can send me this too...
0
 
interCommented:
Just place the following after showmessage:
  PostMessage(edit1.handle, WM_LBUTTONUP,0,0);
regards, igor
0
 
keithcslAuthor Commented:
Thanks for the answer. I have actually tried the PostMessage but placed it before the ShowMessage rather than after. But it is working now...

PJDB, Matvey
I have sent u a copy of the .exe. Sorry I could not have sent it earlier...

Keith
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now