Thomas DeWeese <[EMAIL PROTECTED]> schrieb am 15.12.2004 13:05:30:

> [EMAIL PROTECTED] wrote:
>
> > i am trying to implement 'copy&paste' in my application. First i thought
> > everything works great, when i pressed ctrl-c the selected text was
> > copied to the clibboard. Then i realized i do not have press ctrl-c, the
> > text always gets copied to clipboard when a selection is made (you can
> > see this in org.apache.batik.gvt.text.ConcreteTextSelector). I think
> > this is not very nice that i select a textnode and my clipboard gets
> > flushed.
>
>     This is standard behavior on some systems (X Windows).  The person
> who originally implemented this was a UNIX head.  It's not as bad
> as you think once you get used to it...
>
> > I think there is even a little bug in this behaviour: the text is only
> > copied to clipboard when you select it by dragging the mouse on a
> > textnode. When you select the textnode with a double-click nothing is
> > copied to clipboard.
>
>     I'll check on this.  It would probably be best to have the
> the TextSelectionManager do the copying to the clipboard
> if appropriate rather than burying this in the text selector.
> This would make it a bit easier for the UI code to 'set policy'.
>
> > Can anybody give me a little tip my how to implement a 'usual'
> > copy&paste (user has to press a button or ctrl-c)? In the api i found
> > the class TextSelectionManager, but i do not know how to use it.
>
>     Well the first thing is to turn off the default behavior.
> This can be done by subclassing TextSelectionManager to use
> another custom subclass of ConcreteTextSelector.  Your
> subclass of ConcreteTextSelector will simply override copyToClipboard
> into a NOP.



I already had this idea, but won´t work cause copyToClipboard() is private, same
problem I had with other functions in ConcreteTextSelector.



>
>     Then you can have your code call
> 'ConcreteTextSelector.getSelection()' when an appropriate key
> combination is pressed.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

Reply via email to