TabStop on Custom Control based on Canvas [message #412253] |
Thu, 22 January 2004 18:45 |
Eclipse User |
|
|
|
Originally posted by: yuraukar.hotmail.com
I have written a custom control derived
from Canvas. What do I need to do, so
the user can tab into the control when it
is places on a composite?
I have seen the SWT snippet showing how
to tab within a canvas, but how can I make
the canvas be able to tab into by default?
Yuraukar
|
|
|
|
Re: TabStop on Custom Control based on Canvas [message #412330 is a reply to message #412307] |
Fri, 23 January 2004 14:25 |
Eclipse User |
|
|
|
Originally posted by: yuraukar.hotmail.com
Konstantin Scheglov wrote:
> Yuraukar <yuraukar@hotmail.com> wrote:
>
>
>>I have written a custom control derived
>>from Canvas. What do I need to do, so
>>the user can tab into the control when it
>>is places on a composite?
>
>
>>I have seen the SWT snippet showing how
>>to tab within a canvas, but how can I make
>>the canvas be able to tab into by default?
>
> I am not 100% sure, but try to add some KeyListener using
> addKeyListener().
>
Thing is, I would like to be able to "place" the custom
widget into any window and it should automatically intetrate
with its parent's tab order - much like Text, List and
the other widgets do.
There may be methods to customize the parent's traverse
listener or the parent's key listener, but this seems
inappropriate to me.
In other words, how does a composite know by default which
of its clients are in the tab order and which are not?
Again: somehow composite seems to "know" that Text and List
are widgets to tab into and Label isn't.
Yuraukar.
|
|
|
Re: TabStop on Custom Control based on Canvas [message #412338 is a reply to message #412330] |
Fri, 23 January 2004 16:11 |
Steve Northover Messages: 1636 Registered: July 2009 |
Senior Member |
|
|
This snippet contains all you need:
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/plat form-swt-home/snippits/snippet21.html
When you listen for keyboard events in a Canvas, that means you want focus.
If you want focus, then you need to be able to take part in tab traversal.
If you are taking part in tab traversal, you must implement SWT.Traverse to
tell SWT which traversal keys you want it to process. That's all there is
to it.
"Yuraukar" <yuraukar@hotmail.com> wrote in message
news:burap3$120$1@eclipse.org...
> Konstantin Scheglov wrote:
> > Yuraukar <yuraukar@hotmail.com> wrote:
> >
> >
> >>I have written a custom control derived
> >>from Canvas. What do I need to do, so
> >>the user can tab into the control when it
> >>is places on a composite?
> >
> >
> >>I have seen the SWT snippet showing how
> >>to tab within a canvas, but how can I make
> >>the canvas be able to tab into by default?
> >
> > I am not 100% sure, but try to add some KeyListener using
> > addKeyListener().
> >
>
> Thing is, I would like to be able to "place" the custom
> widget into any window and it should automatically intetrate
> with its parent's tab order - much like Text, List and
> the other widgets do.
> There may be methods to customize the parent's traverse
> listener or the parent's key listener, but this seems
> inappropriate to me.
>
> In other words, how does a composite know by default which
> of its clients are in the tab order and which are not?
> Again: somehow composite seems to "know" that Text and List
> are widgets to tab into and Label isn't.
>
> Yuraukar.
|
|
|
Re: TabStop on Custom Control based on Canvas [message #412508 is a reply to message #412338] |
Fri, 23 January 2004 17:59 |
Eclipse User |
|
|
|
Originally posted by: yuraukar.hotmail.com
Steve Northover wrote:
> This snippet contains all you need:
>
> http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/plat form-swt-home/snippits/snippet21.html
>
> When you listen for keyboard events in a Canvas, that means you want focus.
> If you want focus, then you need to be able to take part in tab traversal.
> If you are taking part in tab traversal, you must implement SWT.Traverse to
> tell SWT which traversal keys you want it to process. That's all there is
> to it.
>
> "Yuraukar" <yuraukar@hotmail.com> wrote in message
> news:burap3$120$1@eclipse.org...
>
>>Konstantin Scheglov wrote:
>>
>>>Yuraukar <yuraukar@hotmail.com> wrote:
>>>
>>>
>>>
>>>>I have written a custom control derived
>>>
>>>>from Canvas. What do I need to do, so
>>>
>>>>the user can tab into the control when it
>>>>is places on a composite?
>>>
>>>
>>>>I have seen the SWT snippet showing how
>>>>to tab within a canvas, but how can I make
>>>>the canvas be able to tab into by default?
>>>
>>> I am not 100% sure, but try to add some KeyListener using
>>>addKeyListener().
>>>
>>
>>Thing is, I would like to be able to "place" the custom
>>widget into any window and it should automatically intetrate
>>with its parent's tab order - much like Text, List and
>>the other widgets do.
>>There may be methods to customize the parent's traverse
>>listener or the parent's key listener, but this seems
>>inappropriate to me.
>>
>>In other words, how does a composite know by default which
>>of its clients are in the tab order and which are not?
>>Again: somehow composite seems to "know" that Text and List
>>are widgets to tab into and Label isn't.
>>
>>Yuraukar.
>
>
>
Ok, I misunderstood the sample snippet. Thanks for the explanation.
Yuraukar
|
|
|
Powered by
FUDForum. Page generated in 0.02998 seconds