Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

API (select text)

Posted on 1998-08-14
5
Medium Priority
?
249 Views
Last Modified: 2010-04-04
How can i disable the API for text selecting (mouse & keyboard)?
0
Comment
Question by:kort77
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 8

Expert Comment

by:ZifNab
ID: 1362097
disabling an API? which one, by name?
0
 
LVL 2

Expert Comment

by:333
ID: 1362098
Catch the message and set focus to another component.
0
 
LVL 8

Accepted Solution

by:
Answers2000 earned 100 total points
ID: 1362099
If you mean on an Edit control you want to prevent the user selecting text then the way to do it is whenever you get EN_SELCHANGE notification, immediately set the cursor to the beginning of the selection point (by sending EM_SETSEL message to the control).

One thing to watch out for is you're own EM_SETSEL messages may also trigger EN_SELCHANGE notifications (therefore getting you into an infinite loop).  Avoid this by only checking the selection (using EM_GETSEL) and only sending EM_SETSEL whenever something is selected.

0
 

Author Comment

by:kort77
ID: 1362100
I need that the code worrks in all the system, not just in one application
0
 
LVL 2

Expert Comment

by:333
ID: 1362101
The following code deselects all items in ListBox:

procedure TForm1.ListBox1Click(Sender: TObject);
begin
  SendMessage(ListBox1.Handle,lb_SetCurSel,-1,0);
end;

But there will be a gray rectangle around last selected item. To prevent this add to procedure something like

Button1.SetFocus;

to set focus on another control.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

719 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