Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsDisposal of used (Tree-)Editor edit-controls
https://www.eclipse.org/forums/index.php/mv/msg/147120/463181/#msg_463181
I don't understand, why Snippet111 and in code JavaDoc for TreeEditor
disposes the used Text Controls on every Listeners invocation.
Why don't just Listen for SWT.FocusOut on Text, saving the result,
setVisible(false) and reusing the same Text control for next action, by
setting again its content with .setText() and just .setEditor() once
again?
A
--]]>Adam Pordzik2005-10-28T16:00:31-00:00Re: Disposal of used (Tree-)Editor edit-controls
https://www.eclipse.org/forums/index.php/mv/msg/147120/463200/#msg_463200
If it works, that will be better way doing it.
Note that snippets do not mean best ways doing things.
They are just examples!
"Adam Pordzik" <adresseverbummelt@gmx.de> wrote in message
news:djthv0$h5m$1@news.eclipse.org...
> Hello,
>
> I don't understand, why Snippet111 and in code JavaDoc for TreeEditor
> disposes the used Text Controls on every Listeners invocation.
> Why don't just Listen for SWT.FocusOut on Text, saving the result,
> setVisible(false) and reusing the same Text control for next action, by
> setting again its content with .setText() and just .setEditor() once
> again?
>
> A
>
> --
>]]>No real name2005-10-29T22:34:41-00:00Re: Disposal of used (Tree-)Editor edit-controls
https://www.eclipse.org/forums/index.php/mv/msg/147120/463201/#msg_463201
> Did you test your method?
> If it works, that will be better way doing it.
More or less. Or: Yes, with some tricks at least on Win32. The edit
control (e.g Text) sometimes reappeared in upper-left corner from
nowhere, if I didn't set it explicitly hidden. Also, I played with
setControl( null, null ); But I didn't looked in TreeEdit's surces
yet.
And I have absolute no idea what will happen on other platforms.
Moreover, -I cant figure out why- the SWT-SocusOut Listener was not
called for Text, so the Control keeps visible and I had to focus
it again by mouse and leave it again. But I guess this is due an
other issue.
> Note that snippets do not mean best ways doing things.
> They are just examples!
Sure. But I just had to ask, because I can't see the reason.
A
--]]>Adam Pordzik2005-10-30T12:28:53-00:00Re: Disposal of used (Tree-)Editor edit-controls
https://www.eclipse.org/forums/index.php/mv/msg/147120/463202/#msg_463202
> called for Text, so the Control keeps visible and I had to focus
> it again by mouse and leave it again. But I guess this is due an
> other issue.
P.S. I faced this is only with Combo. Text works fine. Would be nice if anybody can
confirm this as "working" on other platforms.
final TreeEditor treeEditor = new TreeEditor (tree);
treeEditor.minimumWidth = 100;
treeEditor.minimumHeight = tree.getItemHeight();
treeEditor.horizontalAlignment = SWT.LEFT;
treeEditor.grabHorizontal = false;
final Text treeText = new Text (tree, SWT.BORDER);
class TreeEditHandler implements Listener {
public void handleEvent( Event e ) {
TreeItem titi;
if( e.type == SWT.KeyDown && e.keyCode == SWT.F2 ) {
titi = tree.getSelection()[0];
} else if( e.type == SWT.DefaultSelection || e.type == SWT.Selection ) {
titi = (TreeItem)e.item;
} else {
return;
}
treeText.setText( titi.getText() );