|
Re: disable cut/copy/paste on StyledText [message #331758 is a reply to message #331744] |
Fri, 19 September 2008 19:20 |
Grant Gayed Messages: 2150 Registered: July 2009 |
Senior Member |
|
|
Hi Sheela,
In the snippet below cut and paste are successfully vetoed. Copy still
happens, but this should not be a big problem since it does not modify the
StyledText's content. Does the snippet below work similarly for you? And
if so, can you change it in a way that makes it show your problem?
public static void main (String [] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setBounds(10,10,200,200);
shell.setLayout(new FillLayout());
StyledText text = new StyledText(shell, SWT.NONE);
text.setText("hihihihi");
text.addListener(SWT.Verify, new Listener() {
public void handleEvent(Event event) {
event.doit = false;
}
});
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
Grant
"Sheela " <sheela_kalyanpur@infosys.com> wrote in message
news:159b1ad8786d86425886e25b641abffc$1@www.eclipse.org...
> Hi,
>
> I have created a header partition in my editor and made it uneditable by
> implementing verifyText() method of VerifyListener which is a listener on
> the StyledText.
> It is working perfectly (and does not allow any keyboard modifications to
> the header) except that I am still able to cut a part of the header or
> paste some text in the header.
>
> How do I disable the cut/copy/paste actions in the partition ?
>
> Thanks in Advance
>
> Regards,
> Sheela
>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03957 seconds