[RWT] Shell defaultButton [message #660909] |
Tue, 22 March 2011 10:09 |
Jens Kreidler Messages: 17 Registered: July 2009 |
Junior Member |
|
|
Hi rap community and developers,
I've got a question about the shell's setDefaultButton - method in rwt.
Is it possible to clear the default button (to empty, i.e. no button)?
The java-doc for Shell#setDefaultButton( Button button ) states:
Quote: |
If the argument is not null, sets the receiver's default button to the argument, and if the argument is null, sets the receiver's default button to the first button which was set as the receiver's default button (called the saved default button). If no default button had previously been set, or the saved default button was disposed, the receiver's default button will be set to null.
|
I do not exactly understand that doc. So it is not possible to set the default button to 'none'?
Assuming that a shell by default has the save (first) button as default button, all subsecently calls 'setDefaultButton( null )' always set the default button to the previous set button, that is the save button ...
|
|
|
Re: [RWT] Shell defaultButton [message #660918 is a reply to message #660909] |
Tue, 22 March 2011 11:06 |
Rüdiger Herrmann Messages: 335 Registered: July 2009 |
Senior Member |
|
|
Jens,
from playing around with the snippet below in SWT, I don't get the right
clue either:
shell.setDefaultButton( savedDefault );
System.out.println( shell.getDefaultButton() ); // savedDefault
shell.setDefaultButton( defaultButton );
System.out.println( shell.getDefaultButton() ); // defaultButton
shell.setDefaultButton( null );
System.out.println( shell.getDefaultButton() ); // defaultButton ???
shell.setDefaultButton( null );
System.out.println( shell.getDefaultButton() ); // null
However, resetting the default button twice or something like
while( shell.getDefaultButton() != null ) {
shell.setDefaultButton( null );
}
should do.
You may ask on the SWT forum get a proper explanation. If you do so,
please let us know the answer here.
HTH
Rüdiger
On 22.03.2011 11:09, Jens Kreidler wrote:
> Hi rap community and developers,
>
> I've got a question about the shell's setDefaultButton - method in rwt.
> Is it possible to clear the default button (to empty, i.e. no button)?
>
> The java-doc for Shell#setDefaultButton( Button button ) states:
> Quote:
>> If the argument is not null, sets the receiver's default button to the
>> argument, and if the argument is null, sets the receiver's default
>> button to the first button which was set as the receiver's default
>> button (called the saved default button). If no default button had
>> previously been set, or the saved default button was disposed, the
>> receiver's default button will be set to null.
>
>
> I do not exactly understand that doc. So it is not possible to set the
> default button to 'none'?
> Assuming that a shell by default has the save (first) button as default
> button, all subsecently calls 'setDefaultButton( null )' always set the
> default button to the previous set button, that is the save button ...
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.02842 seconds