| Combo-(viewer) XWT-Databinding trouble [message #901158] |
Fri, 10 August 2012 03:27  |
Jürgen Weinberger Messages: 26 Registered: August 2012 |
Junior Member |
|
|
Hi!
I got following problem with the comboviewer databinding in xwt.
I want to provide the user with a list of predefined items in the combolist but he should also be able to type some custom text into the viewer.
How can i realize this? (I don't care if i have to use comboviewer or just the combo-widget). When i use the selectionEvent i only get the selected text and null if he typed something custom.
I played around and achieved to get one thing running at a time but not both. I think this should work something like this:
<ComboViewer x:style="BORDER" input="{Binding Path=possibleRoles}">
<ComboViewer.combo text="{Binding Path=roleName}"/>
</ComboViewer>
But i always get a NullPointer exception.
Has anybody an idea how to achieve this?
regards weinma
|
|
|
|
| Re: Combo-(viewer) XWT-Databinding trouble [message #901178 is a reply to message #901164] |
Fri, 10 August 2012 04:33   |
Jürgen Weinberger Messages: 26 Registered: August 2012 |
Junior Member |
|
|
Yes, but that seems to be my next problem. Event handling won't work.
Started following experiment and nothing (button nor combo) works.
Exceptions are always Eventhandler "onSelection" not found and Eventhander "onModifyCombo" not found.
package aasdaa;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
public class HelloWorld extends Composite {
public HelloWorld(Composite parent, int style) {
super(parent, style);
// TODO Auto-generated constructor stub
}
/**
* @param Object
* @param Event
*/
protected void onSelection(Object o, Event event) {
System.out.println("Button pressed");
}
/**
* @param Object
* @param Event
*/
public void onModifyCombo(Object object, Event event) {
System.out.println("Combo modified");
}
}
I also tried this code without the object parameter in the method call and just the Event parameter, as suggested in some tutorials. Same result
<Composite xmlns="http://www.eclipse.org/xwt/presentation"
xmlns:x="http://www.eclipse.org/xwt"
xmlns:c="clr-namespace:aasdaa"
xmlns:j="clr-namespace:java.lang"
x:Class="aasdaa.HelloWorld">
<Composite.layout>
<GridLayout numColumns="3" />
</Composite.layout>
<Button text="hello" x:style="SWT.PUSH" selectionEvent="onSelection">
</Button>
<Combo x:style="SWT.NONE" modifyEvent="onModifyCombo">
<Combo.items></Combo.items>
</Combo>
</Composite>
I think this should work but i don't have an idea why it doen't.
regards weinma
[Updated on: Fri, 10 August 2012 04:34] Report message to a moderator
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02693 seconds