Return-Path: Delivered-To: apmail-pivot-user-archive@www.apache.org Received: (qmail 24261 invoked from network); 4 Mar 2011 13:38:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Mar 2011 13:38:27 -0000 Received: (qmail 24122 invoked by uid 500); 4 Mar 2011 13:38:27 -0000 Delivered-To: apmail-pivot-user-archive@pivot.apache.org Received: (qmail 24097 invoked by uid 500); 4 Mar 2011 13:38:27 -0000 Mailing-List: contact user-help@pivot.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@pivot.apache.org Delivered-To: mailing list user@pivot.apache.org Received: (qmail 24081 invoked by uid 99); 4 Mar 2011 13:38:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Mar 2011 13:38:27 +0000 X-ASF-Spam-Status: No, hits=2.8 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of cbartlett.x@gmail.com designates 209.85.215.182 as permitted sender) Received: from [209.85.215.182] (HELO mail-ey0-f182.google.com) (209.85.215.182) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Mar 2011 13:38:22 +0000 Received: by eyg7 with SMTP id 7so724468eyg.13 for ; Fri, 04 Mar 2011 05:38:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=gpZ9KAuuewiHqAHQQEMbiYIEIx3aB9xs1avwF64L4TE=; b=UAlg8fqdfbSCtyXTlNiVdSJihheFZBNWPGFPCAsfDDM8CtlCfRG24o0ilcTqbaE8k5 OGrkk7xDKdmaWC67RpAvErqJOduDe/Tnouax5stp9gzdXRGv9HPGq8kDK/8taOolsOvZ QL3w6+PGx4QCqfewpzjcZ0JJu8Ieuo84A14+M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=GwPWQNf+OO6oveNEBIKYNnO6DaTml7VmQmQWLF0eppep3zvaowZwWlpVknosmBnqp2 7T97QJsC6ikXtVmP55TpXALNpwUanpwv6vijIp2IeYd0uT6AK/gjhMfT+eSujkhZiKP4 via++DtE+Igg93qrHirfMLmJ/VM+GEX9+g3S4= MIME-Version: 1.0 Received: by 10.14.17.2 with SMTP id i2mr403566eei.47.1299245880180; Fri, 04 Mar 2011 05:38:00 -0800 (PST) Received: by 10.14.124.140 with HTTP; Fri, 4 Mar 2011 05:38:00 -0800 (PST) In-Reply-To: <5B66D873-5C28-4987-A13D-A30023B0F904@verizon.net> References: <5B66D873-5C28-4987-A13D-A30023B0F904@verizon.net> Date: Fri, 4 Mar 2011 20:38:00 +0700 Message-ID: Subject: Re: KeyListeners on ImageView From: Chris Bartlett To: user@pivot.apache.org Cc: Pivot Dev Content-Type: multipart/alternative; boundary=0016e6570bc62a01ec049da8416c --0016e6570bc62a01ec049da8416c Content-Type: text/plain; charset=ISO-8859-1 Greg, I wasn't specifically thinking about Windows and both understand and agree with your reasoning regarding where keyboard events would be sent. I was thinking more about adding a little (optional) flexibility regarding Pivot's current focusability of Components. Being able to make an ImageView focusable 'solves' the issue from the original post in this thread, but conversely, being able to quickly disable the focusability of a Component might be a simpler way for developers to manage a Container's focus compared to creating a custom FocusTraversalPolicy. Both of these are relatively straightforward to code at present, but a setFocusable(boolean) method would reduce the amount of code required. It could be provided with a caveat that changing the value from its default may have consequences as you mentioned, and may not be a complete solution (absence of a graphical indication of focus). Anyway, I'm not sold either way at present. If someone thinks it is a good idea and wants to push it, feel free! Some example use cases would certainly help. Chris On 4 March 2011 19:44, Greg Brown wrote: > I had a similar thought. Unfortunately, making a Window focusable will > break apps that currently call window.requestFocus() to focus the content > component. Those apps would have to change to call > window.getContent().requestFocus(). That's not out of the question, but > seems wrong - container focusability was added primarily to support > composite components like Spinner rather than layout or navigation > components, or windows. > > I'd be surprised if this is actually a common issue in practice, though. In > most applications, some component generally has the focus, so key strokes > will be propagated to the window. What is the use case for sending key > strokes to a window when nothing is focused? How would we know which window > to send them to? > > > > On Mar 4, 2011, at 4:31 AM, Chris Bartlett wrote: > > CCed to the Dev mailing list where it is perhaps best to continue the > discussion > (Some context for the Dev list > > http://apache-pivot-users.399431.n3.nabble.com/KeyListeners-on-ImageView-tp2600622p2600622.html > ) > > On 4 March 2011 11:35, Bill van Melle wrote: > >> I shouldn't have to stand on my head creating a focusable subclass of >> WindowSkin. (Admittedly, Chris has shown that it's easy to do, but it seems >> wrong to make everyone do it.) >> > > I wonder if there is a case to be made for adding a setFocusable(boolean) > method to Component which could be used easily to change focusability? Each > Component would maintain its current default focusability, but this could be > toggled with a simple call to pivotComponent.setFocusable(true/false) rather > than the need for sub-classing.. > > Changing a normally focusable Component to be non-focusable should not > cause any problems, but changing a normally non-focusable > Component/Container to be focusable would probably mean that there is no > graphical indicator that the Component has focus. If a user really needed > this they could still create a custom skin which would paint the indicator > (or add a conditional Decorator). > > They could also supply a FocusTraversalPolicy to Containers to meet their > individual needs. > > Chris > > > --0016e6570bc62a01ec049da8416c Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Greg,

I wasn't specifically thinking abou= t Windows and both understand and agree with your reasoning regarding where= keyboard events would be sent.

I was thinking= more about adding a little (optional) flexibility regarding Pivot's cu= rrent focusability of Components. =A0Being able to make an ImageView focusa= ble 'solves' the issue from the original post in this thread, but c= onversely, being able to quickly disable the focusability of a Component mi= ght be a simpler way for developers to manage a Container's focus compa= red to creating a custom FocusTraversalPolicy. =A0Both of these are relativ= ely straightforward to code at present, but a setFocusable(boolean) method = would reduce the amount of code required. =A0It could be provided with a ca= veat that changing the value from its default may have consequences as you = mentioned, and may not be a complete solution (absence of a graphical indic= ation of focus).

Anyway, I'm not sold either way at present. =A0
If someone thinks it is a good idea and wants to push it, feel free!= =A0Some example use cases would certainly help.

C= hris

On 4 March 2011 19:44, Greg Brown= <gk_brown@ver= izon.net> wrote:
I had a similar thought. Unfortunately,= making a Window focusable will break apps that currently call window.reque= stFocus() to focus the content component. Those apps would have to change t= o call window.getContent().requestFocus(). That's not out of the questi= on, but seems wrong - container focusability was added primarily to support= composite components like Spinner rather than layout or navigation compone= nts, or windows.

I'd be surprised if this is actually a common issue in p= ractice, though. In most applications, some component generally has the foc= us, so key strokes will be propagated to the window. What is the use case f= or sending key strokes to a window when nothing is focused? How would we kn= ow which window to send them to?



On Mar 4, 2011= , at 4:31 AM, Chris Bartlett wrote:

CCed to the Dev mailing list where it is perhaps best to continue the= discussion
(Some context for the Dev list

On 4 March 2011 11:35, Bill van Melle <= bill.van.melle@gmail.com> wrote:
I shouldn't have to stand on my head cr= eating a focusable subclass of WindowSkin. (Admittedly, Chris has shown tha= t it's easy to do, but it seems wrong to make everyone do it.)

I wonder if there is a case to be made for= adding a setFocusable(boolean) method to Component which could be used eas= ily to change focusability? Each Component would maintain its current defa= ult focusability, but this could be toggled with a simple call to pivotCo= mponent.setFocusable(true/false) rather than the need for sub-classing..
Changing a normally focusable Component to be non-focusable should not = cause any problems, but changing a normally non-focusable Component/Contain= er to be focusable would probably mean that there is no graphical indicator= that the Component has focus. If a user really needed this they could sti= ll create a custom skin which would paint the indicator (or add a condition= al Decorator).

They could also supply a FocusTraversalPolicy to Containers to meet the= ir individual needs.

Chris


--0016e6570bc62a01ec049da8416c--