Article View: comp.os.ms-windows.programmer.win32
Article #2180Re: Clipboard "delayed rendering"
From: Jon Shemitz
Date: Sun, 01 Feb 1998 00:00
Date: Sun, 01 Feb 1998 00:00
63 lines
3944 bytes
3944 bytes
Chris Thornton wrote:
> >Thing is, I get a WM_RENDERFORMAT request for the CF_TEXT format as soon
> >as I call CloseClipboard().
> >
> >Is this 'by design' and unavoidable? Or is there some way I can force
> >Windows to delay rendering the CF_TEXT until it's requested, too?
>
> If there are any clipboard utilities installed, such as my own ClipMate,
> they'll ask for the data as soon as its posted. You'll get the same
> behavior as if you were running clipbrd.exe, which auto-pastes everything
> into itself.
> But wait, you say. You're not running any clipboard viewers? Ha!
> Some applications, for apparently no good reason, paste TEXT into themselves
> so that they can light up their menus and toolbar buttons. It should be
> enough that they just query the clipboard to see if CF_TEXT is available,
> but certain apps don't stop there. They are looking for TEXT with a
> particular structure to it, such as to see if the text contains things
> they're interested in. Such as decriptions of forms, buttons, and other
> controls....
>
> Yes, you're likely being burned by Delphi3 or Delphi2. And so have I.
> They both auto-paste CF_TEXT into themselves, and I'd suspect other Borland
> development environments do so as well.
Oh, that makes sense, unfortunately. I found that the request for
rendering was being generated inside of the call to CloseClipboard() -
and that is the logical place for clipboard viewer messages to be
generated.
It seems a poor design for Delphi and BCB to look for CF_TEXT with a
particular structure, though. It would seem to make more sense to use a
private, binary format, and to use delayed rendering in the relatively
rare cases where the user pastes a widget into a text file. Then they
wouldn't have to check every piece of pasted text.
Unfortunately, since I use Delphi for a Web editor - and, more
generally, since one will typically be copying source code out of the
IDE onto the clipboard - it seems that this is a problem I just have to
live with. The best solution is probably what I temporized on last night
- render HTML (CF_TEXT) immediately, but delay RTF rendering until it's
actually requested.
> Rather than using delayed rendering, maybe you should just do nothing until
> the user clicks? Otherwise, if you're auto-pasting all text into yourself,
> then you're setting yourself up for "wars" with any clipboard enhancement
> utilities out there.
>
> I'd just sit idle, until the user clicks. Then, grab the data, and flip
> your icon to a "busy" state. When done, give a little beep, flip your to
> "done", put your data onto the clipboard, and then the user can paste.
Umm, that's what I *was* doing. I didn't write a clipboard viewer that
converts all text that gets pasted! The problem is that
parsing+rendering+rendering on the user's double-click can be slow.
That's why I want(ed) to reduce it to parse-on-double-click,
render-on-paste.
--
http://www.midnightbeach.com - for info about me, my work, my writing,
and my homeschool resource pages.
Technical Details
Message-ID:
<34D4F34C.798A6B59@midnightbeach.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<34D40BE9.1B4DD708@midnightbeach.com> <6b227k$3vu3@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1091e5,172a182732b08709 X-Google-Attributes: gid1091e5,public X-Google-Thread: 113dfb,172a182732b08709 X-Google-Attributes: gid113dfb,public X-Google-Thread: f5ca7,172a182732b08709 X-Google-Attributes: gidf5ca7,public From: Jon Shemitz <jon@midnightbeach.com> Subject: Re: Clipboard "delayed rendering" Date: 1998/02/01 Message-ID: <34D4F34C.798A6B59@midnightbeach.com> X-Deja-AN: 321174677 Content-Transfer-Encoding: 7bit References: <34D40BE9.1B4DD708@midnightbeach.com> <6b227k$3vu3@forums.borland.com> Content-Type: text/plain; charset=us-ascii Organization: Midnight Beach Mime-Version: 1.0 Reply-To: jon@midnightbeach.com Newsgroups: comp.os.ms-windows.programmer.win32,borland.public.cppbuilder.winapi,borland.public.delphi.winapi