Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Text does not lose focus after switching Composite on StackLayout
Text does not lose focus after switching Composite on StackLayout [message #1176524] Fri, 08 November 2013 11:38 Go to next message
Maciej Lypik is currently offline Maciej LypikFriend
Messages: 2
Registered: November 2013
Junior Member
Hi,
I'm trying to create composite on which I can switch between different text fields using combo. This composite is supposed to be a part of class which is property section of Eclipse plugin and implements ITabbedPropertyConstants. I'm using Graphiti framework and what I'm doing here is properties tab that opens when selecting pictogram on a diagram. So far I've come with the following design:
Composite
----Combo selection
----Composite contentPanel
--------Composite cNumeric
------------Text numeric 
--------Composite cText
------------Text text

Composite contentPanel has StackedLayout and holds all composites with desired fields.
Brief description: after combo selection, topControl of contentPanel layout is set to appropriate composiste and layout() is called on contentPanel.
Visually everything works as it supposed to - desired text field appears after selecting combo option.
My problem is that after I switch composite and deselect pictogram by clicking anywhere else on diagram, Text does not receive FocusOut event. Here is what I get when I capture all focus events on main composite (repeated events omitted):
FigureCanvas {} - FOCUS IN
FigureCanvas {} - FOCUS OUT
//Here I open properties tab, change combo selection from Numeric to Text, and edit field value
Combo {Numeric} - FOCUS IN
Combo {Text} - FOCUS IN
Combo {Text} - FOCUS OUT
Text {} - FOCUS IN
//Now I deselect pictogram
FigureCanvas {} - FOCUS IN

When I do the same, but without changing composite I get the following result:
FigureCanvas {} - FOCUS IN
FigureCanvas {} - FOCUS OUT
//Here I open properties tab and edit field value
Combo {Text} - FOCUS IN
Combo {Text} - FOCUS OUT
Text {} - FOCUS IN
//Now I deselect pictogram
Text {} - FOCUS OUT
FigureCanvas {} - FOCUS IN

I wanted to use focus listener to save input date and I don't see any alternative without using something like save button, which I want to avoid.

I have no idea what am I doing wrong, and I would appreciate any pointers.
Re: Text does not lose focus after switching Composite on StackLayout [message #1182599 is a reply to message #1176524] Tue, 12 November 2013 09:36 Go to previous message
Maciej Lypik is currently offline Maciej LypikFriend
Messages: 2
Registered: November 2013
Junior Member
After trying some workarounds I found a solution to my problem - I started using both Focus and Dispose listeners.

During debugging I discovered that after I change top composite on StackLayout and deselect pictogram, widgets are immediately disposed and no FocusLost event is sent. If I don't change top composite and deselect pictogram, FocusLost event is sent and widgets are not disposed for a while.
Previous Topic:BrowserFunction unable to convert returned Object array
Next Topic:[Releng] How to setup a swt source workspace
Goto Forum:
  


Current Time: Thu Apr 25 05:10:21 GMT 2024

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

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

Back to the top