[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] set focus in a shell.

I have a dialog (status dialog) with some SWT widgets on it (text1, text2, 
checkButton1, checkButton2). When the dialog opens, I want to set focus to 
a particular widget based on some logic in setInitialFocus() function. How 
can I achieve this? I have tried the following:

1. Override the open() function of the dialog. This this function, call 
the super.open() function followed by the setInitialFocus() function.
This works, but there is a limitation. After the call to open() the focus 
is set to the default widget, which is the first widget on the dialog. And 
then the focus is set to the widget in the setInitialFocus() method. This 
produces a flickr.

2. Override the create() function and call setInitialFocus after calling 
super.create(). This does not work. The problem here is that the widget is 
not visible at this point as the dialog has not opened yet.

3. attach a listener to the shell of the dialog and override the 
shellActivated function. This also does not work because at the point this 
function is called, the shell is active and enabled but not visible. I do 
not understand how this state is created. 

Can somebody please give suggestions.

Thanks,
Upkar.