Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-03

Clipboard.HasFormat issue

5 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt

Hi,

Is there a reason why ClipBoard.HasFormat() is so slow ?

Putting a call to ClipBoard.HasFormat() in an OnUpdate handler of an action coupled to a toolbutton, seriously slows down an application, to the point of being unusable. If I comment out the call, the application responds normally.

This is on Linux (GTK1). I looked at the clipboard calls, but on the first look of things I see no reason why it should be so slow, except maybe the ClipboardGetFormats() call.

The strange thing is that if something suitable is on the clipboard, the application responds normally.

Michael.

Mehmet Erol Sanliturk
to Michael Van Canneyt
pm Michael Van Canneyt wrote 16 lines
Hi, Is there a reason why ClipBoard.HasFormat() is so slow ? Putting a call to ClipBoard.HasFormat() in an OnUpdate handler of an action coupled to a toolbutton, seriously slows down an application, to the point of being unusable. If I comment out the call, the application responds normally. The strange thing is that if something suitable is on the clipboard, the application responds normally. Michael.

I do not know exactly but a possibility may be to wait an acceptable value to appear there . This may be tested as follows :
Assume there is no any acceptable value in clipboard . When your application starts to wait , an acceptable value may be appended to clipboard from another application .
If it gets this value immediately we may say that it is waiting for a proper value to appear there .
If it does not respond immediately and continues to wait , there is another problem .

Thank you very much .

Mehmet Erol Sanliturk

Hans-Peter Diettrich
to Michael Van Canneyt: Is there a reason why ClipBoard.HasFormat() is so slow ? Putting a call to…
Show quoted text 5 lines
Is there a reason why ClipBoard.HasFormat() is so slow ? Putting a call to ClipBoard.HasFormat() in an OnUpdate handler of an action coupled to a toolbutton, seriously slows down an application, to the point of being unusable. If I comment out the call, the application responds normally.

The request may go to the clipboard owner, which is responsible for providing the clipboard contents in the various formats. The system also may search for conversion tools, capable to render the desired format from one of the supplied formats.

This is on Linux (GTK1). I looked at the clipboard calls, but on the first look of things I see no reason why it should be so slow, except maybe the ClipboardGetFormats() call.

I only know about the Windows clipboard, not on other systems. The graphics system should not be involved on any platform.

The strange thing is that if something suitable is on the clipboard, the application responds normally.

Isn't there a method EnumClipboardFormats, which should return only the currently available formats?

DoDi

Michael Van Canneyt
to Hans-Peter Diettrich
Hans-Peter Diettrich wrote 25 lines
Michael Van Canneyt schrieb: > Is there a reason why ClipBoard.HasFormat() is so slow ? > > Putting a call to ClipBoard.HasFormat() in an OnUpdate handler of an action > coupled to a toolbutton, seriously slows down an application, to the point > of being unusable. If I comment out the call, the application responds normally. The request may go to the clipboard owner, which is responsible for providing the clipboard contents in the various formats. The system also may search for conversion tools, capable to render the desired format from one of the supplied formats. > This is on Linux (GTK1). I looked at the clipboard calls, but on the first > look of things I see no reason why it should be so slow, except maybe the > ClipboardGetFormats() call. I only know about the Windows clipboard, not on other systems. The graphics system should not be involved on any platform. > The strange thing is that if something suitable is on the clipboard, > the application responds normally. Isn't there a method EnumClipboardFormats, which should return only the currently available formats?

The HasFormat() function calls EnumClipboardFormats, among other things. I'll investigate how it behaves if I call EnumClipboardFormats directly.

Michael.

Alexander Klenin
to Michael Van Canneyt
Michael Van Canneyt wrote
The HasFormat() function calls EnumClipboardFormats, among other things. I'll investigate how it behaves if I call EnumClipboardFormats directly.

While at it, could you reproduce http://bugs.freepascal.org/view.php?id=11548 ? I still get this error occasionally, and from my investigation it has something to do with
HasFormat / EnumClipboardFormats and timing.

Alexander S. Klenin