R2.0.2, Win2K
I agree with Kyle Farnand who describes the problem accurately and correctly: I see exactly the same thing (and have posted before
about this, but the threads died).
As far as I can tell, these are the facts (R2.0.2, Win2K):
1) Text widget: comes with an OS-supplied popupmenu in which are items Cut/Copy/Paste (but Ctrl-C/V/X do *NOT* work); if you add
your own popupmenu (via SWT) you lose the whole OS-supplied menu; if you then add to your own popupmenu, your own items
Cut/Copy/Paste, and hook the API for those actions, you can restore the Cut/Copy/Paste function, but there appears to be NO way to
get Ctrl-C/V/X to work (with or without a popupmenu).
2) StyledText widget: comes with *NO* popupmenu; you can add your own popupmenu (via SWT, pretty much the same as for the Text);
to your own popupmenu, you can add your own items Cut/Copy/Paste, and hook the API for those actions, thus for the first time
obtaining the Cut/Copy/Paste function, but there appears to be NO way to get Ctrl-C/V/X to work (with or without a popupmenu).
Maybe what Knut and Lynne are saying is that in R2.1, the Ctrl-C/V/X has somehow been fixed (via fixing some bug not known to have
been connected, but nevertheless connected)?
Paul K
Knut Radloff wrote:
Which build and OS are you using? Copy to clipboard (using Ctrl+C) works for me in a read-only single line Text and StyledText
widget in R2.1
I searched the StyledText bugs we fixed in 2.1 and didn't see anything cut/paste related that may have caused your problem.
Knut
"kyle farnand" <kfarnand@xxxxxxxxxxxxx> wrote in message news:b7n3jl$sh7$1@xxxxxxxxxxxxxxxx
Looking at the Text tab of the SWT Controls sample view and playing
around with all the different parameters, there were no parameters that
I could set to get CTRL-C to work in either the Text or Styled Text
widget (including READ_ONLY). Right Click->Copy worked with any
parameter settings on the Text widget but not on the StyledText widget.
Is this the desired functionality for the StyledText widget?
kyle farnand wrote:
I must be doing something wrong then. I tried CTRL-C and paste the
results into notepad and don't get anything. I know about the API but
was hoping to get this functionality for free (which seems possible). In
the Text widget you get <right-click> menu -> copy functionality and was
hoping that would be the same in StyledText widget.
Lynne Kues wrote:
I do not understand what you are talking about.
If the StyledText widget is READ_ONLY, the copy operation is available
(select some text and press CTRL-C), but you cannot paste to or cut
from the
widget since it is readonly. Also note that there is API in the
StyledText
widget to cut, copy and paste programatically.
"kyle farnand" <kfarnand@xxxxxxxxxxxxx> wrote in message
news:b7mtas$n7d$1@xxxxxxxxxxxxxxxx
When I use the below code, I get copy and paste for free.
Text modelText = new Text(modelXMLContainer, SWT.READ_ONLY |SWT.MULTI);
modelText.setText(modelString);
But when I used the StyledText widget, I lose this functionality.
StyledText modelText = new StyledText(modelXMLContainer,
SWT.READ_ONLY);
modelText.setText(modelString);
An earlier post said I should get the same copy and paste functionality
if I use SWT.READ_ONLY in the constructor from both widgets but that is
not the case.
Is there an easy way to get this copy and paste functionality out of the
StyledText widget (as in the Text widget) or do I have to implement it
myself?