Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Funny behaviour of mouse click...

Posted on 1998-04-21
6
Medium Priority
?
164 Views
Last Modified: 2010-04-06
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
Comment
Question by:keithcsl
6 Comments
 
LVL 1

Expert Comment

by:pjdb
ID: 1335714
Change the autoselect to false and the text won't be selected during the onenter event of the Tedit box.

JDB
0
 
LVL 1

Author Comment

by:keithcsl
ID: 1335715
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
 
LVL 1

Expert Comment

by:pjdb
ID: 1335716
Can u send it to jeanditbailleulp@usa.net , I will take a look

JDB
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 3

Expert Comment

by:Matvey
ID: 1335717
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
 
LVL 5

Accepted Solution

by:
inter earned 200 total points
ID: 1335718
Just place the following after showmessage:
  PostMessage(edit1.handle, WM_LBUTTONUP,0,0);
regards, igor
0
 
LVL 1

Author Comment

by:keithcsl
ID: 1335719
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

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question