Thread View: comp.os.ms-windows.programmer.win32
3 messages
3 total messages
Started by Jon Shemitz
Sat, 31 Jan 1998 00:00
Clipboard "delayed rendering"
Author: Jon Shemitz
Date: Sat, 31 Jan 1998 00:00
Date: Sat, 31 Jan 1998 00:00
24 lines
1831 bytes
1831 bytes
I've spent longer than I should on a little tray app that reads source
code from the clipboard and writes it back, syntax highlighted, in HTML
and RTF. Because it's very slow (rendering a mere 44K of source takes ca
a minute on a P90), I decided to implement "delayed rendering". When the
user double clicks on the tray icon, the app parses the source to a
global token list, and puts a NULL on the clipboard in CF_TEXT and "Rich
Text Format". Then, when the user tries to paste plain text, the app
renders HTML; when the user tries to paste rich text, the app renders
RTF.
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?
The MSDN CD doesn't seem to say anything about "delayed rendering"
that's not in the SDK help files ....
--
http://www.midnightbeach.com - for info about me, my work, my writing,
and my homeschool resource pages.
Re: Clipboard "delayed rendering"
Author: Chris Thornton
Date: Sun, 01 Feb 1998 00:00
Date: Sun, 01 Feb 1998 00:00
55 lines
3330 bytes
3330 bytes
Jon, 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. 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. Good Luck, Chris Jon Shemitz wrote in message <34D40BE9.1B4DD708@midnightbeach.com>... >I've spent longer than I should on a little tray app that reads source >code from the clipboard and writes it back, syntax highlighted, in HTML >and RTF. Because it's very slow (rendering a mere 44K of source takes ca >a minute on a P90), I decided to implement "delayed rendering". When the >user double clicks on the tray icon, the app parses the source to a >global token list, and puts a NULL on the clipboard in CF_TEXT and "Rich >Text Format". Then, when the user tries to paste plain text, the app >renders HTML; when the user tries to paste rich text, the app renders >RTF. > >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? > >The MSDN CD doesn't seem to say anything about "delayed rendering" >that's not in the SDK help files .... > >-- > >http://www.midnightbeach.com - for info about me, my work, my writing, > and my homeschool resource pages.
Re: Clipboard "delayed rendering"
Author: 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.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads