While your are implementing the Direct Edit on Your Label Normally it Grow Horizontal.
Here the Changes in your class make your label to grow vertically.
Let’s see how to implement that......
In Two Place Changes to be made.....
1.”DirectEditManager” Class Implement the createCellEditorOn () Method as shown…
protected CellEditor createCellEditorOn(Composite composite) {
return new TextCellEditor(composite, SWT.MULTI | SWT.WRAP);
}
2. “CellEditorLocator” Class Change th
e Line of Code as shown in Bold…
Here the Text move Horizontally according to the Label Width… Then it start growing Vertically.....
public void relocate(CellEditor celleditor) {
Text text = (Text)celleditor.getControl();
Point pref = text.computeSize(
lbl.
getBounds().width,-1);
Rectangle rect = lbl.getTextBounds().getCopy();
lbl.translateToAbsolute(rect);
text.setBounds(rect.x-1,rect.y-1,pref.x+1,pref.y+1);
}
The Output will be......
Regards,
Karthikeyan
0 comments:
Post a Comment