0

I have a window that has textbox, with OK and Cancel buttons. upon clicking Ok button, I need to validate the entered text contains invalid xml characters and show a warning popup message.

I am able to perform this by getting text.getText(). However, if tomorrow a new SWT/AWT Textbox appears in the window, again i will have to modify code to get the getText() from the new control.

Is there a generic method so that, when a new SWT/AWT Textbox is added in that window, we can enforce to validate this invalid xml character check ?

4

1 回答 1

0

使用 SWT.Verify 事件类型。创建一个执行 XML 字符检查的侦听器并将该侦听器添加到窗口中的所有文本框。

这是一个SWT 片段,它显示了 SWT.Verify 事件的使用

于 2012-05-17T04:54:28.733 回答