Skip to main content



      Home
Home » Eclipse Projects » JFace » [Databinding] WidgetProperties.focused() value property not working
[Databinding] WidgetProperties.focused() value property not working [message #496383] Mon, 09 November 2009 14:52 Go to next message
Eclipse UserFriend
Hi all, I have a problem with the focused property value.

I'm creating an observable value, which is observing the property "focused" in the text widget. But this observable value changes only when the text gain the focus, but not if lost it. To test that , I've bound a checkbox to this observable value.
Finally, I've add a listener to the text, and the listener is working fine, but the observable value is not refreshing its value at all.

I think that it is a misunderstanding on my part, conceptually speaking.

Here the code:

    this.text.addFocusListener(new FocusListener() {
			
			@Override
			public void focusLost(FocusEvent e) {
				System.out.println("FOCUS LOST");
				
			}
			
			@Override
			public void focusGained(FocusEvent e) {
				System.out.println("FOCUS GAINED");
				
			}
		});
		

		IObservableValue textFocusObservable = WidgetProperties.focused().observe(this.text);
    //data binding context
		dbc.bindValue(WidgetProperties.selection().observe(this.check), textFocusObservable);



Thanks on advance,

Juan


Re: [Databinding] WidgetProperties.focused() value property not working [message #496632 is a reply to message #496383] Tue, 10 November 2009 13:03 Go to previous messageGo to next message
Eclipse UserFriend
A dirty way that I've found to solve this is to use a WritableValue and change the writable value in the listener events. This is only a workaround, perhaps somebody needs a quick and dirty solution Razz .

If somebody knows the real answer, please post it, I'm eager to know it.

Thanks,

Juan
Re: [Databinding] WidgetProperties.focused() value property not working [message #496672 is a reply to message #496632] Tue, 10 November 2009 16:14 Go to previous message
Eclipse UserFriend
Juan Lagostena wrote:
> If somebody knows the real answer, please post it, I'm eager to know it.

The solution is to fix it in DataBinding. Filed bug 294810 [1].

I was looking into this yesterday, unfortunately I haven't gotten a unit
test for this yet. What I suspect is that Control.isFocusI suspect that
this might be that Control.hasFocus() is still true during a
SWT.FocusOut event.

Do you have a standalone snippet we could use to confirm this bug and
verify a fix? If so it would be very helpful if you would attach it to
the bug.

Matthew

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=294810
Previous Topic:MultiLineRule - wrong endSequence
Next Topic:Cannot see image decorator
Goto Forum:
  


Current Time: Thu Nov 06 06:22:12 EST 2025

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

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

Back to the top