[Lazarus] Clipboard changes

Flávio Etrusco flavio.etrusco at gmail.com
Sat Oct 8 03:24:51 CEST 2011


On Fri, Oct 7, 2011 at 6:31 PM, Mattias Gaertner
<nc-gaertnma at netcologne.de> wrote:
> On Fri, 7 Oct 2011 14:35:18 -0300
> Flávio Etrusco <flavio.etrusco at gmail.com> wrote:
>
>> On Fri, Oct 7, 2011 at 1:37 PM, Mattias Gaertner
>> <nc-gaertnma at netcologne.de> wrote:
>> > On Fri, 7 Oct 2011 13:26:16 -0300
>> > Flávio Etrusco <flavio.etrusco at gmail.com> wrote:
>> >
>> >> Hello,
>> >> I would like some feedback by anyone using or knowledgeable in the LCL
>> >> clipboard design on the changes introduced by this (already committed)
>> >> patch:
>> >> http://bugs.freepascal.org/view.php?id=20089
>> >
>> > What's the problem?
>> >
>> > Mattias
>> >
>> > --
>>
>> I made TWin32WidgetSet.ClipboardFormatToMimeType raise an exception
>> when Windows.GetClipboardFormatName returns empty (either a Windows
>> predefined format or an error). At the last it will be triggered by
>> code that uses TClipboard.FindFormatID (or iterate over available
>> formats names in the clipboard) if there's a predefined format in the
>> clipboard the LCL doesn't know about. Is that ok?
>> I didn't see any other issues, but the LCL uses MIME strings more
>> extensively than initially thought, so I'm asking for advice.
>
> Raising an exception in an LCL interface function is unusual.

Is this why assigning icons to the clipboard doesn't raise exceptions
even though it's not implemented? ;-)
If it's not reaised there, I think it should be raised in some other
places anyway - in TRasterImage.LoadFromMimeStream for instance.

> What do you mean with "a predefined format in the clipboard the LCL
> doesn't know about"?
>
>
> Mattias
>

GetClipboardFormatName(1) doesn't return a string for "standard
formats" (2) - sometimes called predefined formats in the docs -, so
the LCL itself (i.e. TWin32WidgetSet.ClipboardFormatToMimeType) must
"know" their MIME types.

(1) http://msdn.microsoft.com/en-us/library/windows/desktop/ms649040%28v=vs.85%29.aspx
(2) http://msdn.microsoft.com/en-us/library/windows/desktop/ff729168%28v=vs.85%29.aspx

There're some other info and comments in the bug report.

-Flávio




More information about the Lazarus mailing list