Solved

RichEdit1.Perform(EM_CANPASTE, 0, 0) <> 0;

Posted on 1998-07-30
6
563 Views
Last Modified: 2011-04-14
In the RichEdit example with Delphi 4 it uses
RichEditEditor.Perform(EM_CANPASTE, 0, 0) <> 0; to find out if there is something to paste from the clipboard.  I am trying to do the same but with a ComboBox but it does not work. Any suggestion ?
 
0
Comment
Question by:moonrise
[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
  • 3
  • 3
6 Comments
 
LVL 10

Expert Comment

by:viktornet
ID: 1359283
It doesn't compile because there is no message EM_CANPASTE for TComboBox...That's why it can not perform it...

To see what messages the combobox has look 'em up in the win32 help file

Regards,
Viktor Ivanov
0
 

Author Comment

by:moonrise
ID: 1359284
I fount this constant to be in Richedit.pas. I created my own constant so it compiles fine. But I don't get the right result like I do with a RichEdit component.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1359285
Why do you actually do you need to paste something from the clipborad...Let's say it's a whole file, then what? Everything copied will get into your combobox...

Regards,
Viktor Ivanov
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:moonrise
ID: 1359286
There is a PASTE button on my form. This button has to be disabled when there is nothing in the clipboard to paste. My form is a webbrowser and the combobox is the url.  The paste can also occur on the web page. It does not matter because all components use the same clipboard.  If I had a richedit on that screen I would use it and I would have no problem. Just like I could place a dummy richedit, make it invisible, just to be able to use it to check if there is something in the clipboard.  

So the question is why does that work with richedit and not with other components ?
0
 
LVL 10

Accepted Solution

by:
viktornet earned 50 total points
ID: 1359287
Hello Moonrise, if you just want to check that, and if it doesn't matter to you what way are you using then , you can use this way to check and paste what's in the clipboard if its format is text...
----------------
uses clipbrd;

procedure TForm1.PasteButtonClick(Sender: TObject);
var ClipBoard : TClipBoard;
begin
  if ClipBoard.HasFormat(CF_TEXT) then  
    SendMessage(ComboBox1.Handle, WM_PASTE, 0, 0);
end;
---------------------------
If there is text in the clipboard then the text will be pasted in the combobox...I hope that answers your question...not exactly, but this is one of the ways to do it... :)

Regards,
Viktor Ivanov

0
 

Author Comment

by:moonrise
ID: 1359288
Good, it does exacly what I need. In fact it is even better because that way the paste button will remain disabled if there is let say a picture in the clipboard.  Thank you.
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

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…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

734 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