Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » XWT : access widget element
XWT : access widget element [message #571471] Tue, 23 March 2010 19:57 Go to next message
jamin is currently offline jamin
Messages: 4
Registered: March 2010
Junior Member
Hi all,

I would like to access to a xwt widget element from the java class.
For example, access to ToolItem "B" from method "onSelectionA".

How could I do that ?

<Composite ...>
<ToolBar x:style="SWT.NONE" x:Class="MyToolbar">
<ToolItem x:style="SWT.PUSH" text="A" selectionEvent="onSelectionA">
</ToolItem>
<ToolItem x:style="SWT.PUSH" text="B" ></ToolItem>
</ToolBar>

public class MyToolbar extends XWTStaticPart {
public void onSelectionA(Object object, Event event) {
// ...
}
}
Re: XWT : access widget element [message #571508 is a reply to message #571471] Tue, 23 March 2010 20:52 Go to previous message
jamin is currently offline jamin
Messages: 4
Registered: March 2010
Junior Member
ok, I found the solution by setting the 'name' attribute and getting element using 'findElementByName' method.

<Composite x:Class="MyView">
<ToolBar >
<ToolItem x:name="Name1" x:style="SWT.PUSH" ></ToolItem>
</ToolBar>
</Composite>

public void onSelection(Object object, Event event) {
Object name1 = XWT.findElementByName( event.widget, "Name1");
if (w != null && w instanceof ToolItem ) {
System.out.println("NAME1 OK");
}
}
Previous Topic:XWT : access widget element
Next Topic:e4 Designer support for org.eclipse.ui.Forms
Goto Forum:
  


Current Time: Sat Sep 20 10:06:27 GMT 2014

Powered by FUDForum. Page generated in 0.13819 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software