Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » TabStop on Custom Control based on Canvas
TabStop on Custom Control based on Canvas [message #412253] Thu, 22 January 2004 18:45 Go to next message
Eclipse UserFriend
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 #412307 is a reply to message #412253] Fri, 23 January 2004 11:13 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
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().

--
SY, Konstantin.
Advanced Eclipse SWT Designer (http://www.swt-designer.com)


Konstantin Scheglov,
Google, Inc.
Re: TabStop on Custom Control based on Canvas [message #412330 is a reply to message #412307] Fri, 23 January 2004 14:25 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
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 Go to previous message
Eclipse UserFriend
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
Previous Topic:Switch between different composites
Next Topic:View design confusion
Goto Forum:
  


Current Time: Fri Apr 26 07:11:13 GMT 2024

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

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

Back to the top