[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools] Re: cut, copy, paste in StyledText Widget

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?