|
|
|
|
Re: Enable/Disable ToolItem [message #549086 is a reply to message #549076] |
Sat, 24 July 2010 04:11  |
Eclipse User |
|
|
|
Hi,
Ok you should have been more specific in your question. The answer from
me and Paul was about the e4-Workbench-ToolItems while you are talking
about XWT.
I'd suggest for the future that people use [xwt] in the subject if their
question is on this topic.
Tom
Am 24.07.10 05:10, schrieb Walter Prabhakar:
> My xwt contains the following
> .
> <ToolBar x:style="SWT.NONE">
> <ToolItem x:Data="test" x:style="SWT.PUSH" SelectionEvent="onTI1Clicked"
> image="/icons/sample.gif" Loaded="performToolItemLoaded"></ToolItem>
> <ToolItem x:Data="test1" x:style="SWT.PUSH"
> SelectionEvent="onTI2Clicked"
> image="/icons/sample.gif" Loaded="performToolItemLoaded"></ToolItem>
> </ToolBar>
>
> The ToolItem getControl is null as demonstrated with this snippet.
>
> Map oM = new HashMap ( ) ;
> public void performToolItemLoaded(Object object, Event event) {
> ToolItem oTI = (ToolItem) event.widget;
> System.out.println ( oTI.getData() ) ;
> oM.put(oTI.getData(), oTI) ;
> }
> public void onTI1Clicked(Object object, Event event) {
> ToolItem oTI = (ToolItem) event.widget;
> System.out.println ( oTI.getData() ) ;
> oTI = ( ToolItem ) oM.get ( "test1" ) ;
> if ( oTI.getControl ( ) == null )
> System.err.println ( "test1 control: " + oTI.getControl ( ) ) ;
> else
> oTI.getControl().setEnabled(false) ;
> }
> public void onTI2Clicked(Object object, Event event) {
> ToolItem oTI = (ToolItem) event.widget;
> System.out.println ( oTI.getData() ) ;
> }
>
> How do I disable a tool item when another tool item is clicked ?
>
> Thanks
> - Walter
>
>
>
>
> "Tom Schindl" <tom.schindl@bestsolution.at> wrote in message
> news:i2c1sm$13s$1@build.eclipse.org...
>> Sure get access to the model and call setEnabled() but often this is
>> controlled by the Command-Attached to it.
>>
>> Tom
>>
>> Am 23.07.10 14:14, schrieb Walter Prabhakar:
>>> Is it possible to enable/disable toolitem programatically ?
>>>
>>> - Walter.
>>
>
|
|
|
Re: Enable/Disable ToolItem [message #579264 is a reply to message #548900] |
Fri, 23 July 2010 08:28  |
Eclipse User |
|
|
|
Sure get access to the model and call setEnabled() but often this is
controlled by the Command-Attached to it.
Tom
Am 23.07.10 14:14, schrieb Walter Prabhakar:
> Is it possible to enable/disable toolitem programatically ?
>
> - Walter.
|
|
|
|
Re: Enable/Disable ToolItem [message #579396 is a reply to message #548901] |
Fri, 23 July 2010 23:10  |
Eclipse User |
|
|
|
My xwt contains the following
..
<ToolBar x:style="SWT.NONE">
<ToolItem x:Data="test" x:style="SWT.PUSH" SelectionEvent="onTI1Clicked"
image="/icons/sample.gif" Loaded="performToolItemLoaded"></ToolItem>
<ToolItem x:Data="test1" x:style="SWT.PUSH"
SelectionEvent="onTI2Clicked"
image="/icons/sample.gif" Loaded="performToolItemLoaded"></ToolItem>
</ToolBar>
The ToolItem getControl is null as demonstrated with this snippet.
Map oM = new HashMap ( ) ;
public void performToolItemLoaded(Object object, Event event) {
ToolItem oTI = (ToolItem) event.widget;
System.out.println ( oTI.getData() ) ;
oM.put(oTI.getData(), oTI) ;
}
public void onTI1Clicked(Object object, Event event) {
ToolItem oTI = (ToolItem) event.widget;
System.out.println ( oTI.getData() ) ;
oTI = ( ToolItem ) oM.get ( "test1" ) ;
if ( oTI.getControl ( ) == null )
System.err.println ( "test1 control: " + oTI.getControl ( ) ) ;
else
oTI.getControl().setEnabled(false) ;
}
public void onTI2Clicked(Object object, Event event) {
ToolItem oTI = (ToolItem) event.widget;
System.out.println ( oTI.getData() ) ;
}
How do I disable a tool item when another tool item is clicked ?
Thanks
- Walter
"Tom Schindl" <tom.schindl@bestsolution.at> wrote in message
news:i2c1sm$13s$1@build.eclipse.org...
> Sure get access to the model and call setEnabled() but often this is
> controlled by the Command-Attached to it.
>
> Tom
>
> Am 23.07.10 14:14, schrieb Walter Prabhakar:
>> Is it possible to enable/disable toolitem programatically ?
>>
>> - Walter.
>
|
|
|
Re: Enable/Disable ToolItem [message #579408 is a reply to message #549076] |
Sat, 24 July 2010 04:11  |
Eclipse User |
|
|
|
Hi,
Ok you should have been more specific in your question. The answer from
me and Paul was about the e4-Workbench-ToolItems while you are talking
about XWT.
I'd suggest for the future that people use [xwt] in the subject if their
question is on this topic.
Tom
Am 24.07.10 05:10, schrieb Walter Prabhakar:
> My xwt contains the following
> .
> <ToolBar x:style="SWT.NONE">
> <ToolItem x:Data="test" x:style="SWT.PUSH" SelectionEvent="onTI1Clicked"
> image="/icons/sample.gif" Loaded="performToolItemLoaded"></ToolItem>
> <ToolItem x:Data="test1" x:style="SWT.PUSH"
> SelectionEvent="onTI2Clicked"
> image="/icons/sample.gif" Loaded="performToolItemLoaded"></ToolItem>
> </ToolBar>
>
> The ToolItem getControl is null as demonstrated with this snippet.
>
> Map oM = new HashMap ( ) ;
> public void performToolItemLoaded(Object object, Event event) {
> ToolItem oTI = (ToolItem) event.widget;
> System.out.println ( oTI.getData() ) ;
> oM.put(oTI.getData(), oTI) ;
> }
> public void onTI1Clicked(Object object, Event event) {
> ToolItem oTI = (ToolItem) event.widget;
> System.out.println ( oTI.getData() ) ;
> oTI = ( ToolItem ) oM.get ( "test1" ) ;
> if ( oTI.getControl ( ) == null )
> System.err.println ( "test1 control: " + oTI.getControl ( ) ) ;
> else
> oTI.getControl().setEnabled(false) ;
> }
> public void onTI2Clicked(Object object, Event event) {
> ToolItem oTI = (ToolItem) event.widget;
> System.out.println ( oTI.getData() ) ;
> }
>
> How do I disable a tool item when another tool item is clicked ?
>
> Thanks
> - Walter
>
>
>
>
> "Tom Schindl" <tom.schindl@bestsolution.at> wrote in message
> news:i2c1sm$13s$1@build.eclipse.org...
>> Sure get access to the model and call setEnabled() but often this is
>> controlled by the Command-Attached to it.
>>
>> Tom
>>
>> Am 23.07.10 14:14, schrieb Walter Prabhakar:
>>> Is it possible to enable/disable toolitem programatically ?
>>>
>>> - Walter.
>>
>
|
|
|
Powered by
FUDForum. Page generated in 0.04977 seconds