Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left

43 messages Options
Embed this post
Permalink
1 2 3
Vidyashankar Vellal

Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left

Reply Threaded More More options
Print post
Permalink
Hi

The patch has been attached. The patch was made against the CVS HEAD (1.3.10). The details are as follows:

Problem:
When a tab of the wxTreebook is selected, OK button does not respond to Enter. This is because key events (wxKeyEvent) are not propogated along the parent chain. Hence, when the wxTreeCtrl (present in wxTreebook) captures the event, nothing happens.

Solution:
1) I have created an event handler and pushed it to the tree control present in mCategories (which is the wxTreebook). This event handler captures the press of enter button. It then creates an instance of a custom event (see point 2)  and processes it. This custom event (unlike wxKeyEvent) can propogate up the parent chain and is eventually handled by PrefsDialog. When it is handled by PrefsDialog it calls the same function as when OK button is pressed (i.e. PrefsDialog::OnOK)
2) The custom event is derived from wxCommandEvent (which helps it to propogate up the parent chain). The event declarations and macro definitions are present in the code along with comments.

I have tested the patch on both Linux and Windows and it is working as expected. I dont have a Mac, so havent tested on that. I expect it to work on Mac too since there is no platform dependent code change.

This is my first patch. In case I did anything wrong, please tell me so that I can correct my mistakes next time.
I have added comments wherever appropriate. In case you feel it was too much/too less, please do tell me.

Thanks
Vidyashankar


[P3PrefsEnterBtn.patch]

? P3PrefsEnterBtn.patch
Index: src/prefs/PrefsDialog.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/prefs/PrefsDialog.cpp,v
retrieving revision 1.69
diff -u -r1.69 PrefsDialog.cpp
--- src/prefs/PrefsDialog.cpp 27 Jul 2009 15:36:37 -0000 1.69
+++ src/prefs/PrefsDialog.cpp 2 Sep 2009 17:40:53 -0000
@@ -67,8 +67,16 @@
 BEGIN_EVENT_TABLE(PrefsDialog, wxDialog)
    EVT_BUTTON(wxID_OK, PrefsDialog::OnOK)
    EVT_BUTTON(wxID_CANCEL, PrefsDialog::OnCancel)
+   EVT_ENTER(PrefsDialog::OnOK) //Handles the custom event
 END_EVENT_TABLE()
 
+BEGIN_EVENT_TABLE(EnterBtnEvtHandler, wxEvtHandler)
+   EVT_KEY_DOWN(EnterBtnEvtHandler::OnEnterBtnPress)
+END_EVENT_TABLE()
+
+DEFINE_EVENT_TYPE(EVT_ENTER_BTN_PRESSED)
+IMPLEMENT_DYNAMIC_CLASS(CustomEnterEvent, wxCommandEvent)
+
 PrefsDialog::PrefsDialog(wxWindow * parent)
 :  wxDialog(parent, wxID_ANY, wxString(_("Audacity Preferences")),
             wxDefaultPosition,
@@ -85,6 +93,12 @@
          S.Prop(1);
          S.AddWindow(mCategories, wxEXPAND);
 
+         // Used to capture the press of Enter Button
+         // when a tab is selected on the left panel
+         wxTreeCtrl *categoriesTree = mCategories->GetTreeCtrl();
+         EnterBtnEvtHandler *enterHandler = new EnterBtnEvtHandler();
+         categoriesTree->PushEventHandler(enterHandler);
+
          wxWindow *w;
          // Parameters are: AppPage( page, name, IsSelected, imageId)
          w = new DevicePrefs(mCategories);      mCategories->AddPage(w, w->GetName(), false, 0);
@@ -218,6 +232,18 @@
    SelectPageByName(_("Directories"));  
 }
 
+void EnterBtnEvtHandler::OnEnterBtnPress(wxKeyEvent & event)
+{
+   // When Enter button is pressed
+   // A new instance of the custom event is created
+   // which is handled later by PrefsDialog
+   if(event.GetKeyCode() == WXK_RETURN) {
+      CustomEnterEvent e(EVT_ENTER_BTN_PRESSED);
+      e.SetEventObject(this);
+      ProcessEvent(e);
+   }
+}
+
 
 // Indentation settings for Vim and Emacs and unique identifier for Arch, a
 // version control system. Please do not modify past this point.
Index: src/prefs/PrefsDialog.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/prefs/PrefsDialog.h,v
retrieving revision 1.10
diff -u -r1.10 PrefsDialog.h
--- src/prefs/PrefsDialog.h 4 Apr 2009 10:55:56 -0000 1.10
+++ src/prefs/PrefsDialog.h 2 Sep 2009 17:40:53 -0000
@@ -38,6 +38,40 @@
    DECLARE_EVENT_TABLE()
 };
 
+class EnterBtnEvtHandler:public wxEvtHandler
+{
+ public:
+   void OnEnterBtnPress(wxKeyEvent & e);
+ private:
+   DECLARE_EVENT_TABLE()
+};
+
+// This custom event is used when
+// Enter button is pressed with a tab selected in the left panel
+class CustomEnterEvent:public wxCommandEvent
+{
+ public:
+   CustomEnterEvent(wxEventType commandType = wxEVT_NULL)
+      :wxCommandEvent(commandType) {}
+   CustomEnterEvent(const CustomEnterEvent & event):wxCommandEvent(event) {}
+   virtual wxEvent * clone() const {
+      return new CustomEnterEvent(*this);
+   }
+   DECLARE_DYNAMIC_CLASS(CustomEnterEvent);
+};
+
+typedef void (wxEvtHandler::*CustomEnterEventFunction) (CustomEnterEvent&);
+
+// Declares the custom event
+BEGIN_DECLARE_EVENT_TYPES()
+   DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_ENTER_BTN_PRESSED, 801)
+END_DECLARE_EVENT_TYPES()
+
+// Macro for handling the custom event
+// (Currently handled by PrefsDialog)
+#define EVT_ENTER(fn) DECLARE_EVENT_TABLE_ENTRY(EVT_ENTER_BTN_PRESSED, -1, -1, \
+   (wxObjectEventFunction)(wxEventFunction)(CustomEnterEventFunction) & fn, (wxObject *) NULL),
+
 #endif
 
 // Indentation settings for Vim and Emacs and unique identifier for Arch, a


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
James Crook

Re: Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left

Reply Threaded More More options
Print post
Permalink
Hi Vidyashankar,

Thank you for this!  It looks to fix the issue that was posted on the wiki.

However, I am '-1' on applying it.  I wish I had looked at this P3
before, because I don't agree with the wiki that this is or was a problem.

    What I see happen with a Windows build with current code before your
    patch (win XP, CVS HEAD) is that the wxTreeCtrl is absorbing the
    event.  However, IF I first use tab to tab between the controls so
    that focus is on the panel rather than on the wxTreeCtrl, THEN
    <enter> does behave exactly as I would expect and if focus is on the
    OK button, <enter> does close the dialog.

    A normal wxTreeCtrl is supposed to absorb <enter> events and use
    them to open and close subtrees.  It happens that at the moment we
    have only one level in our tree so there is no subtree to open or
    close.  I can imagine in the future we will  need to have sub trees.
      For example under tracks we might have "labels, spectrograms,
    envelopes, waves", and under bindings we might have "keyboard,
    mouse".  When we do that we will want <enter> to open and close the
    subtree and this patch would prevent that.  If we get more elaborate
    and pass <enter> to the  panel only when there is no subtree to open
    or close I think we're behaving in a rather too non standard way, so
    I don't feel it is a good idea to do that.

Vidyashankar - I looked at your code, and in coding terms it looks
fine.  The problem is really ours, that there are different opinions on
what needs fixing now and how.  Your code looks fine.  It's following
guidelines about formatting etc and it is clear what its intention is.  
I did wonder about the magic constant 801 - if we'd decided to go with
this patch or a modified version that would need at the least a comment.

 > This is my first patch

Congratulations on getting this far.  If it weren't for the issue above
it would have been an excellent choice of first bug.  If you're
interested in tackling one of the other issues on the release checklist,
please say which one.  We can then make sure the problem is better
understood and that there is general agreement about what needs to
happen, and hopefully avoid effort going into code that is then not used.


--James.



Vidyashankar Vellal wrote:

> Hi
>
> The patch has been attached. The patch was made against the CVS HEAD
> (1.3.10). The details are as follows:
>
> Problem:
> When a tab of the wxTreebook is selected, OK button does not respond
> to Enter. This is because key events (wxKeyEvent) are not propogated
> along the parent chain. Hence, when the wxTreeCtrl (present in
> wxTreebook) captures the event, nothing happens.
>
> Solution:
> 1) I have created an event handler and pushed it to the tree control
> present in mCategories (which is the wxTreebook). This event handler
> captures the press of enter button. It then creates an instance of a
> custom event (see point 2)  and processes it. This custom event
> (unlike wxKeyEvent) can propogate up the parent chain and is
> eventually handled by PrefsDialog. When it is handled by PrefsDialog
> it calls the same function as when OK button is pressed (i.e.
> PrefsDialog::OnOK)
> 2) The custom event is derived from wxCommandEvent (which helps it to
> propogate up the parent chain). The event declarations and macro
> definitions are present in the code along with comments.
>
> I have tested the patch on both Linux and Windows and it is working as
> expected. I dont have a Mac, so havent tested on that. I expect it to
> work on Mac too since there is no platform dependent code change.
>
> This is my first patch. In case I did anything wrong, please tell me
> so that I can correct my mistakes next time.
> I have added comments wherever appropriate. In case you feel it was
> too much/too less, please do tell me.
>
> Thanks
> Vidyashankar
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ------------------------------------------------------------------------
>
> _______________________________________________
> audacity-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>  


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Vidyashankar Vellal

Re: Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left

Reply Threaded More More options
Print post
Permalink
Hi, James

On Sat, Sep 5, 2009 at 6:46 PM, James Crook <[hidden email]> wrote:
   What I see happen with a Windows build with current code before your
   patch (win XP, CVS HEAD) is that the wxTreeCtrl is absorbing the
   event.  However, IF I first use tab to tab between the controls so
   that focus is on the panel rather than on the wxTreeCtrl, THEN
   <enter> does behave exactly as I would expect and if focus is on the
   OK button, <enter> does close the dialog.

   A normal wxTreeCtrl is supposed to absorb <enter> events and use
   them to open and close subtrees.  It happens that at the moment we
   have only one level in our tree so there is no subtree to open or
   close.  I can imagine in the future we will  need to have sub trees.
     For example under tracks we might have "labels, spectrograms,
   envelopes, waves", and under bindings we might have "keyboard,
   mouse".  When we do that we will want <enter> to open and close the
   subtree and this patch would prevent that.  If we get more elaborate
   and pass <enter> to the  panel only when there is no subtree to open
   or close I think we're behaving in a rather too non standard way, so
   I don't feel it is a good idea to do that.
 
Yes, you are right about this.

I did wonder about the magic constant 801 - if we'd decided to go with
this patch or a modified version that would need at the least a comment.
 
Yes I should have commented about 801. In the wxWidgets manual, it mentioned that event identifier value 801 is used to maintain compatibility with 2.8.4. I know we use 2.8.10. But I thought of leaving it 801. (The manual does not say anything else about 801, so I just decided not to change).

I now checked the other custom events in audacity and they use -1 instead of 801. I should have seen that earlier. My mistake.

 > This is my first patch

Congratulations on getting this far.  If it weren't for the issue above
it would have been an excellent choice of first bug.  If you're
interested in tackling one of the other issues on the release checklist,
please say which one.  We can then make sure the problem is better
understood and that there is general agreement about what needs to
happen, and hopefully avoid effort going into code that is then not used.

There is a bug very similar to this on the checklist which I had seen before. So I will discuss it here itself.

P4: Export Multiple success dialog cannot be dismissed with ENTER.

When the success dialog is shown, although the OK button is the default, it does not have the focus. So just pressing <enter> does not dismiss the dialog (in winXp at least). However, after pressing <tab>, the OK button gets the focus and <enter> works as expected.
I just added two more lines of code so that OK button has the focus when the dialog is shown. I have attached the patch. But if you feel that the existing method of pressing <tab> and <enter> is fine, then please ignore the patch.

As you said, when I tackle any other issues, I will discuss it on the mailing list.

Thanks for the feedback.

Vidyashankar
 


--James.



Vidyashankar Vellal wrote:
> Hi
>
> The patch has been attached. The patch was made against the CVS HEAD
> (1.3.10). The details are as follows:
>
> Problem:
> When a tab of the wxTreebook is selected, OK button does not respond
> to Enter. This is because key events (wxKeyEvent) are not propogated
> along the parent chain. Hence, when the wxTreeCtrl (present in
> wxTreebook) captures the event, nothing happens.
>
> Solution:
> 1) I have created an event handler and pushed it to the tree control
> present in mCategories (which is the wxTreebook). This event handler
> captures the press of enter button. It then creates an instance of a
> custom event (see point 2)  and processes it. This custom event
> (unlike wxKeyEvent) can propogate up the parent chain and is
> eventually handled by PrefsDialog. When it is handled by PrefsDialog
> it calls the same function as when OK button is pressed (i.e.
> PrefsDialog::OnOK)
> 2) The custom event is derived from wxCommandEvent (which helps it to
> propogate up the parent chain). The event declarations and macro
> definitions are present in the code along with comments.
>
> I have tested the patch on both Linux and Windows and it is working as
> expected. I dont have a Mac, so havent tested on that. I expect it to
> work on Mac too since there is no platform dependent code change.
>
> This is my first patch. In case I did anything wrong, please tell me
> so that I can correct my mistakes next time.
> I have added comments wherever appropriate. In case you feel it was
> too much/too less, please do tell me.
>
> Thanks
> Vidyashankar
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ------------------------------------------------------------------------
>
> _______________________________________________
> audacity-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel


[P4ExportMultEnterBtn.patch]

? P4ExportMultEnterBtn.patch
Index: src/export/ExportMultiple.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/export/ExportMultiple.cpp,v
retrieving revision 1.55
diff -u -r1.55 ExportMultiple.cpp
--- src/export/ExportMultiple.cpp 30 Jun 2009 21:13:48 -0000 1.55
+++ src/export/ExportMultiple.cpp 5 Sep 2009 15:46:39 -0000
@@ -547,6 +547,8 @@
       }
       dlg.Fit();
       dlg.Center();
+      wxWindow * okBtnPtr = dlg.GetDefaultItem();
+      okBtnPtr->SetFocus();
       dlg.ShowModal();
    }
 


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Gale (Audacity Team)

Re: Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left

Reply Threaded More More options
Print post
Permalink
In reply to this post by James Crook

| From James Crook <[hidden email]>
| Sat, 05 Sep 2009 14:16:27 +0100
| Subject: [Audacity-devel] Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left

> Thank you for this!  It looks to fix the issue that was posted on the wiki.
>
> However, I am '-1' on applying it.  I wish I had looked at this P3
> before, because I don't agree with the wiki that this is or was a problem.
>
>     What I see happen with a Windows build with current code before your
>     patch (win XP, CVS HEAD) is that the wxTreeCtrl is absorbing the
>     event.  However, IF I first use tab to tab between the controls so
>     that focus is on the panel rather than on the wxTreeCtrl, THEN
>     <enter> does behave exactly as I would expect and if focus is on the
>     OK button, <enter> does close the dialog.
>
>     A normal wxTreeCtrl is supposed to absorb <enter> events and use
>     them to open and close subtrees.  It happens that at the moment we
>     have only one level in our tree so there is no subtree to open or
>     close.  I can imagine in the future we will  need to have sub trees.
>       For example under tracks we might have "labels, spectrograms,
>     envelopes, waves", and under bindings we might have "keyboard,
>     mouse".  When we do that we will want <enter> to open and close the
>     subtree and this patch would prevent that.  

Hi James

I am probably the "guilty" party for adding this, however it was
done in response to user complaints, and I'm pretty sure it was
actually suggested on this list that I add it.  

If you fire up 1.3.3 for comparison (the last version when I think
Preferences actually worked intuitively), you will see the problem.
There you can just open Preferences then close it by ENTER, or
arrow up/down the tabs to review them, then close it by ENTER.
The way our current code is now, you can't do that, so it gives
the impression of being broken (I'd say it *is* broken in terms of
what a user would reasonably expect a Preferences window to
do).


> If we get more elaborate and pass <enter> to the  panel only when
> there is no subtree to open  or close I think we're behaving in a rather
> too non standard way, so  I don't feel it is a good idea to do that.

I can see the problem when we have subtrees, but perhaps what you
are suggesting isn't a good idea is exactly what we should do? Can
you elaborate why it isn't a good idea, please? How about right
arrow opens the subtree (it would be indented right, I presume)?

Or, we actually open the subtree when we open preferences (which
has the advantage of making it obvious it is there), and if needs be
have a thin vertical scrollbar for the tabs. Obviously I assume that
Widgets could do that.  You could take a look at Winamp preferences
as an example of scrolling tabs.  


Thanks


Gale






------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Gale (Audacity Team)

Re: Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left

Reply Threaded More More options
Print post
Permalink
In reply to this post by Vidyashankar Vellal

| From Vidyashankar Vellal <[hidden email]>
| Sat, 5 Sep 2009 21:27:06 +0530
| Subject: [Audacity-devel] Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left

>... There is a bug very similar to this on the checklist which I had seen
> before. So I will discuss it here itself.
>
> P4: Export Multiple success dialog cannot be dismissed with ENTER.
>
> When the success dialog is shown, although the OK button is the default, it
> does not have the focus. So just pressing <enter> does not dismiss the
> dialog (in winXp at least). However, after pressing <tab>, the OK button
> gets the focus and <enter> works as expected.
> I just added two more lines of code so that OK button has the focus when the
> dialog is shown. I have attached the patch. But if you feel that the
> existing method of pressing <tab> and <enter> is fine, then please ignore
> the patch.

Thanks, Vidyashankar. In terms of pure usability, why would you have
to tab into a window that has no possibility of accepting user input,
except for OK?

In fact I would say the dialogue is confusing as it is, because it "looks"
as if you might be able to click or tab into the white area and copy the
names or do something else in there, but you can't. And even if you
could, you should still be able to ENTER to accept and close without
having to tab. Maybe we should make the white area functional, or
remove it and just have the file list as a message?



Gale


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
David Bailes-2

Re: Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left

Reply Threaded More More options
Print post
Permalink
In reply to this post by Vidyashankar Vellal
On Sat, Sep 5, 2009 at 4:57 PM, Vidyashankar
Vellal<[hidden email]> wrote:

>
> There is a bug very similar to this on the checklist which I had seen
> before. So I will discuss it here itself.
> P4: Export Multiple success dialog cannot be dismissed with ENTER.
> When the success dialog is shown, although the OK button is the default, it
> does not have the focus. So just pressing <enter> does not dismiss the
> dialog (in winXp at least). However, after pressing <tab>, the OK button
> gets the focus and <enter> works as expected.
> I just added two more lines of code so that OK button has the focus when the
> dialog is shown. I have attached the patch. But if you feel that the
> existing method of pressing <tab> and <enter> is fine, then please ignore
> the patch.

Hi Vidyashankar,
with the current structure of the dialog, having the list as the
initial focus is helpful to users of screen readers (visually impaired
users), as this means that the text above the list is read out, and
the filenames can be easily read if needed. I presume enter doesn't
press the default button because the list is swallowing it? I guess
you can't persuade it not to?

David.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Vidyashankar Vellal

Re: Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left

Reply Threaded More More options
Print post
Permalink
In reply to this post by Gale (Audacity Team)


On Sat, Sep 5, 2009 at 11:47 PM, Gale Andrews <[hidden email]> wrote:

| From Vidyashankar Vellal <vidyashankar.mv@gmail.com>
| Sat, 5 Sep 2009 21:27:06 +0530
| Subject: [Audacity-devel] Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left
>... There is a bug very similar to this on the checklist which I had seen
> before. So I will discuss it here itself.
>
> P4: Export Multiple success dialog cannot be dismissed with ENTER.
>
> When the success dialog is shown, although the OK button is the default, it
> does not have the focus. So just pressing <enter> does not dismiss the
> dialog (in winXp at least). However, after pressing <tab>, the OK button
> gets the focus and <enter> works as expected.
> I just added two more lines of code so that OK button has the focus when the
> dialog is shown. I have attached the patch. But if you feel that the
> existing method of pressing <tab> and <enter> is fine, then please ignore
> the patch.

Thanks, Vidyashankar. In terms of pure usability, why would you have
to tab into a window that has no possibility of accepting user input,
except for OK?

Hi Gale

Ya, pressing <tab> and then <enter> just to press OK is not good for usability. 

In fact I would say the dialogue is confusing as it is, because it "looks"
as if you might be able to click or tab into the white area and copy the
names or do something else in there, but you can't. And even if you
could, you should still be able to ENTER to accept and close without
having to tab. Maybe we should make the white area functional, or
remove it and just have the file list as a message?

To make the white area functional, we can have a text control instead of a list. The text control cannot be edited by the user. However, the user can choose to copy the text if he wants to. We can also write code to close the dialog when Enter is pressed with text control having the focus.

The other choice as you said, is to leave it as a message. In that case, we can either have a static text or convert the whole dialog into a message box. But I thought this method may have a problem: If there are too many files and if the length of the text is long, then the size of the dialog may become abnormal right? Of course, we will not have this problem when we use a multi-line text control.

I would probably go with the text control as it gives the user a choice to copy the text. Once we get a few opinions, we can decide what to do.

Thanks

Vidyashankar



Gale


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Vidyashankar Vellal

Re: Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left

Reply Threaded More More options
Print post
Permalink
In reply to this post by David Bailes-2


On Sun, Sep 6, 2009 at 1:18 AM, David Bailes <[hidden email]> wrote:
On Sat, Sep 5, 2009 at 4:57 PM, Vidyashankar
Vellal<vidyashankar.mv@gmail.com> wrote:
>
> There is a bug very similar to this on the checklist which I had seen
> before. So I will discuss it here itself.
> P4: Export Multiple success dialog cannot be dismissed with ENTER.
> When the success dialog is shown, although the OK button is the default, it
> does not have the focus. So just pressing <enter> does not dismiss the
> dialog (in winXp at least). However, after pressing <tab>, the OK button
> gets the focus and <enter> works as expected.
> I just added two more lines of code so that OK button has the focus when the
> dialog is shown. I have attached the patch. But if you feel that the
> existing method of pressing <tab> and <enter> is fine, then please ignore
> the patch.

Hi Vidyashankar,
with the current structure of the dialog, having the list as the
initial focus is helpful to users of screen readers (visually impaired
users), as this means that the text above the list is read out, and
the filenames can be easily read if needed.

Then, we better have the focus on the list initially. Actually, Gale and I were discussing about converting the list into something functional (like a text control) or remove it and just have a message. Considering screen readers is there any difference between using a text control or using a label (static text)? What do you think is better?
 
I presume enter doesn't
press the default button because the list is swallowing it? I guess
you can't persuade it not to? 

Yes the list is swallowing it. I think it is still possible to handle keyboard events on the list. I will work on this once we decide whether to keep the list as it is or convert it into something else.

Thanks

Vidyashankar 

David.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
David Bailes-2

Re: Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left

Reply Threaded More More options
Print post
Permalink
In reply to this post by James Crook
On Sat, Sep 5, 2009 at 2:16 PM, James Crook<[hidden email]> wrote:

>
>    What I see happen with a Windows build with current code before your
>    patch (win XP, CVS HEAD) is that the wxTreeCtrl is absorbing the
>    event.  However, IF I first use tab to tab between the controls so
>    that focus is on the panel rather than on the wxTreeCtrl, THEN
>    <enter> does behave exactly as I would expect and if focus is on the
>    OK button, <enter> does close the dialog.
>
>    A normal wxTreeCtrl is supposed to absorb <enter> events and use
>    them to open and close subtrees.  It happens that at the moment we
>    have only one level in our tree so there is no subtree to open or
>    close.  I can imagine in the future we will  need to have sub trees.
>      For example under tracks we might have "labels, spectrograms,
>    envelopes, waves", and under bindings we might have "keyboard,
>    mouse".  When we do that we will want <enter> to open and close the
>    subtree and this patch would prevent that.  If we get more elaborate
>    and pass <enter> to the  panel only when there is no subtree to open
>    or close I think we're behaving in a rather too non standard way, so
>    I don't feel it is a good idea to do that.

If it's decided to stay with this behaviour, then it would be worth
sorting out the visual indication of the default button in this
dialog. Standard practice is that when the focus is on a control
(other than the default button) which takes enter as input, then the
visual indication of the default button (coloured bold outline) is
temporarily removed. This information is also available to users of
screen readers. At the moment, the OK is indicated to be the default
button when the tree has focus (and also the buttons in various
categories) but isn't pressed when you press enter, which is
confusing. Most of the other dialogs in Audacity, eg the metadata
editor
do the honourable thing.

David.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
David Bailes-2

Re: Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left

Reply Threaded More More options
Print post
Permalink
In reply to this post by Vidyashankar Vellal
On Sun, Sep 6, 2009 at 9:00 AM, Vidyashankar
Vellal<[hidden email]> wrote:

>
> On Sun, Sep 6, 2009 at 1:18 AM, David Bailes <[hidden email]>
>> Hi Vidyashankar,
>> with the current structure of the dialog, having the list as the
>> initial focus is helpful to users of screen readers (visually impaired
>> users), as this means that the text above the list is read out, and
>> the filenames can be easily read if needed.
>
> Then, we better have the focus on the list initially. Actually, Gale and I
> were discussing about converting the list into something functional (like a
> text control) or remove it and just have a message. Considering screen
> readers is there any difference between using a text control or using a
> label (static text)? What do you think is better?

I'm not really sure, but Leland would be able to tell you if he's reading this.
My impression is that often static text isn't read, but maybe it is if
it's the first thing in a dialog.
You can download a free screen reader from:
http://www.nvda-project.org/wiki/Download
and have a play.
Even my prior statement that in the current dialog, if the initial
focus was the OK button then the label of the list box wouldn't
automatically get read, is only by best guess. You could try it with
the nvda screeen reader if you wanted.

David.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Gale (Audacity Team)

Re: Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left

Reply Threaded More More options
Print post
Permalink
In reply to this post by David Bailes-2

| From David Bailes <[hidden email]>
| Mon, 7 Sep 2009 13:39:18 +0100
| Subject: [Audacity-devel] Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left

> On Sat, Sep 5, 2009 at 2:16 PM, James Crook<[hidden email]> wrote:
> >
> >    What I see happen with a Windows build with current code before your
> >    patch (win XP, CVS HEAD) is that the wxTreeCtrl is absorbing the
> >    event.  However, IF I first use tab to tab between the controls so
> >    that focus is on the panel rather than on the wxTreeCtrl, THEN
> >    <enter> does behave exactly as I would expect and if focus is on the
> >    OK button, <enter> does close the dialog.
> >
> >    A normal wxTreeCtrl is supposed to absorb <enter> events and use
> >    them to open and close subtrees.  It happens that at the moment we
> >    have only one level in our tree so there is no subtree to open or
> >    close.  I can imagine in the future we will  need to have sub trees.
> >      For example under tracks we might have "labels, spectrograms,
> >    envelopes, waves", and under bindings we might have "keyboard,
> >    mouse".  When we do that we will want <enter> to open and close the
> >    subtree and this patch would prevent that.  If we get more elaborate
> >    and pass <enter> to the  panel only when there is no subtree to open
> >    or close I think we're behaving in a rather too non standard way, so
> >    I don't feel it is a good idea to do that.
>
> If it's decided to stay with this behaviour, then it would be worth
> sorting out the visual indication of the default button in this
> dialog. Standard practice is that when the focus is on a control
> (other than the default button) which takes enter as input, then the
> visual indication of the default button (coloured bold outline) is
> temporarily removed. This information is also available to users of
> screen readers. At the moment, the OK is indicated to be the default
> button when the tree has focus (and also the buttons in various
> categories) but isn't pressed when you press enter, which is
> confusing. Most of the other dialogs in Audacity, eg the metadata
> editor do the honourable thing.

+1. That's another reason it "appears" to be broken (and I'm still
regarding it as such). I don't have one other app on my computer
where you cannot open the preferences, glance at the content then
hit ENTER to dismiss it. Again, try 1.3.3 to see how it should work.

David, in the sort of Preferences tree you sometimes see where
some tabs are expandable (with a mouse, click on the "+"), would
ENTER be the expected VI way to expand it, and do screen readers
read out that it can be expanded? I would have thought that having
the list pre-expanded would be simpler for VI use, doing which would
appear to remove the objection to solving the subject problem.




Gale
   


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Vidyashankar Vellal

Re: Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left

Reply Threaded More More options
Print post
Permalink
Hello

I used the NVDA screen reader in audacity and two other applications (to verify standard behavior). This is what I observed.

1) As soon as a dialog is opened, it reads whatever has focus. For example, when we open the preferences window in Audacity, and the directories tab in the tree control has the focus, it simply reads "Tree control directories". No mention is made about what the default button is.
Another example is the Export multiple success dialog. When the dialog is opened it simply reads "List control list view" or something similar to this. I dont remember the exact words. Again, no mention is made about the default OK button. Now, if I press the down arrow, it reads the first item in the list (it gets the focus). I can keep scrolling up and down the list and it reads out the item which has focus. If I press <tab> the focus goes to the OK button and it reads "OK button".

2) We were discussing about using a text box (uneditable by the user) instead of a list in the export multiple success dialog. But in screen readers, when the uneditable text box has the focus, it says "edit multiline" and reads out the first line in the text box. This is misleading because the text control cannot be edited by the user. (I checked this by building a sample wxApp and not in audacity).

3) Regarding the treeview:

a) I already mentioned the behaviour in audacity in point 1. As I said, no mention is made of the default button. Perhaps it is "assumed" that the user expects the dialog to be dismissed when Enter is pressed.

b) I tried out the preferences dialog in VLC. When the treeview gets the focus, it reads "tree view Advanced 1 L 1, 1 of 7 with 3". "1 L 1" indicates the current level. 1 of 7 indicates the present selection (1) and the total selections available (7). "with 3" indicates that it can be expanded to get 3 more nodes. When I press the right arrow, the current selection is expanded. Then when I press the down arrow, it goes to the first expanded item and reads "CPU features 2 L 2, 1 of 3 with 0".

c) In Microsoft Visual Studio 2008, I checked the Project Properties dialog. When the treeview gets the focus, it reads "level 1 Framework and references 1 of 1". If I use the down arrow key and go to a selection which can be expanded it reads "level 0 Configuration properties collapsed 2 of 2". Notice the word "collapsed". Now when I press the right arrow key it reads "expanded 9 items". And then as usual I use the down arrow key to go to the expanded items.


So in these two applications, the behavior is: Right and left arrow keys are used to expand and collapse nodes in the treeview. Up and down arrow keys are used to navigate the tree. And regardless of what has focus (unless the focus is on a button) pressing the Enter key dismisses the dialog. I guess we can follow the same convention. Any comments?

Regarding the export multiple success dialog, I guess we can leave it as a list itself. I mentioned the problem of having a text box in point 2.

Once we agree on what should be done, I will work on both these issues.

Thanks

Vidyashankar

On Mon, Sep 7, 2009 at 11:04 PM, Gale Andrews <[hidden email]> wrote:

| From David Bailes <[hidden email]>
| Mon, 7 Sep 2009 13:39:18 +0100
| Subject: [Audacity-devel] Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left
> On Sat, Sep 5, 2009 at 2:16 PM, James Crook<[hidden email]> wrote:
> >
> >    What I see happen with a Windows build with current code before your
> >    patch (win XP, CVS HEAD) is that the wxTreeCtrl is absorbing the
> >    event.  However, IF I first use tab to tab between the controls so
> >    that focus is on the panel rather than on the wxTreeCtrl, THEN
> >    <enter> does behave exactly as I would expect and if focus is on the
> >    OK button, <enter> does close the dialog.
> >
> >    A normal wxTreeCtrl is supposed to absorb <enter> events and use
> >    them to open and close subtrees.  It happens that at the moment we
> >    have only one level in our tree so there is no subtree to open or
> >    close.  I can imagine in the future we will  need to have sub trees.
> >      For example under tracks we might have "labels, spectrograms,
> >    envelopes, waves", and under bindings we might have "keyboard,
> >    mouse".  When we do that we will want <enter> to open and close the
> >    subtree and this patch would prevent that.  If we get more elaborate
> >    and pass <enter> to the  panel only when there is no subtree to open
> >    or close I think we're behaving in a rather too non standard way, so
> >    I don't feel it is a good idea to do that.
>
> If it's decided to stay with this behaviour, then it would be worth
> sorting out the visual indication of the default button in this
> dialog. Standard practice is that when the focus is on a control
> (other than the default button) which takes enter as input, then the
> visual indication of the default button (coloured bold outline) is
> temporarily removed. This information is also available to users of
> screen readers. At the moment, the OK is indicated to be the default
> button when the tree has focus (and also the buttons in various
> categories) but isn't pressed when you press enter, which is
> confusing. Most of the other dialogs in Audacity, eg the metadata
> editor do the honourable thing.

+1. That's another reason it "appears" to be broken (and I'm still
regarding it as such). I don't have one other app on my computer
where you cannot open the preferences, glance at the content then
hit ENTER to dismiss it. Again, try 1.3.3 to see how it should work.

David, in the sort of Preferences tree you sometimes see where
some tabs are expandable (with a mouse, click on the "+"), would
ENTER be the expected VI way to expand it, and do screen readers
read out that it can be expanded? I would have thought that having
the list pre-expanded would be simpler for VI use, doing which would
appear to remove the objection to solving the subject problem.




Gale



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
James Crook

Re: Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left

Reply Threaded More More options
Print post
Permalink
Vidyashankar Vellal wrote:

> c) In Microsoft Visual Studio 2008, I checked the Project Properties
> dialog. When the treeview gets the focus, it reads "level 1 Framework
> and references 1 of 1". If I use the down arrow key and go to a
> selection which can be expanded it reads "level 0 Configuration
> properties collapsed 2 of 2". Notice the word "collapsed". Now when I
> press the right arrow key it reads "expanded 9 items". And then as
> usual I use the down arrow key to go to the expanded items.
>
> So in these two applications, the behavior is: Right and left arrow
> keys are used to expand and collapse nodes in the treeview. Up and
> down arrow keys are used to navigate the tree. And regardless of what
> has focus (unless the focus is on a button) pressing the Enter key
> dismisses the dialog. I guess we can follow the same convention. Any
> comments?
OK.  You (and Gale) have convinced me.  I'm now +1 on your original
patch and the original report of the problem.

I was going by MS studio 2008 project explorer where <enter>
opens/closes a node, but the project properties dialog in the same
program is a closer match to our preferences dialog.

--James.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Vidyashankar Vellal

Re: Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left

Reply Threaded More More options
Print post
Permalink
In the original patch I submitted, the arrow keys do not work as expected. I guess just a small change is required. I will test the patch for the arrow keys behavior (including expanding and collapsing nodes) and then resubmit the patch.

Vidyashankar

On Tue, Sep 8, 2009 at 6:49 PM, James Crook <[hidden email]> wrote:
Vidyashankar Vellal wrote:
> c) In Microsoft Visual Studio 2008, I checked the Project Properties
> dialog. When the treeview gets the focus, it reads "level 1 Framework
> and references 1 of 1". If I use the down arrow key and go to a
> selection which can be expanded it reads "level 0 Configuration
> properties collapsed 2 of 2". Notice the word "collapsed". Now when I
> press the right arrow key it reads "expanded 9 items". And then as
> usual I use the down arrow key to go to the expanded items.
>
> So in these two applications, the behavior is: Right and left arrow
> keys are used to expand and collapse nodes in the treeview. Up and
> down arrow keys are used to navigate the tree. And regardless of what
> has focus (unless the focus is on a button) pressing the Enter key
> dismisses the dialog. I guess we can follow the same convention. Any
> comments?
OK.  You (and Gale) have convinced me.  I'm now +1 on your original
patch and the original report of the problem.

I was going by MS studio 2008 project explorer where <enter>
opens/closes a node, but the project properties dialog in the same
program is a closer match to our preferences dialog.

--James.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
David Bailes-2

Re: Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left

Reply Threaded More More options
Print post
Permalink
In reply to this post by Gale (Audacity Team)
On Mon, Sep 7, 2009 at 6:34 PM, Gale Andrews<[hidden email]> wrote:
>
>
> David, in the sort of Preferences tree you sometimes see where
> some tabs are expandable (with a mouse, click on the "+"), would
> ENTER be the expected VI way to expand it, and do screen readers
> read out that it can be expanded?

I suspect it's not common for enter to be used for
expanding/collapsing container object in the context of preference
dialogs, and I'm
glad to hear that Audacity is going to fit in with the norm.
Screen readers say whether a container object is open/closed.

David.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
David Bailes-2

Re: Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left

Reply Threaded More More options
Print post
Permalink
In reply to this post by Vidyashankar Vellal
On Tue, Sep 8, 2009 at 1:36 PM, Vidyashankar
Vellal<[hidden email]> wrote:
> Hello
> I used the NVDA screen reader in audacity and two other applications (to
> verify standard behavior). This is what I observed.
> 1) As soon as a dialog is opened, it reads whatever has focus. For example,
> when we open the preferences window in Audacity, and the directories tab in
> the tree control has the focus, it simply reads "Tree control directories".
> No mention is made about what the default button is.

You can't do it with NVDA, but when using one of the commercial screen
readers, with the focus on any control in the dialog, the user can
press a keystroke and the screen reader reads what the default button
is.


> 2) We were discussing about using a text box (uneditable by the user)
> instead of a list in the export multiple success dialog. But in screen
> readers, when the uneditable text box has the focus, it says "edit
> multiline" and reads out the first line in the text box. This is misleading
> because the text control cannot be edited by the user. (I checked this by
> building a sample wxApp and not in audacity).

I'm not sure why it does this. I think I remember that Martyn had a
similar problem to this on an earlier version of the Contrast tool.

David.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Vidyashankar Vellal

Re: Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left

Reply Threaded More More options
Print post
Permalink
Hello

I have attached a modified version of the patch for the preferences window. After digging a bit, I found that wxTreeCtrl has a built-in event called EVT_TREE_KEY_DOWN which is a wxTreeEvent. Unlike wxKeyEvent, this can propogate up the parent chain. I have used this in the patch. So there is no need for any extra event handlers or custom events.

The patch is simple. When the enter key is pressed with the tree having the focus, the PrefsDialog::OnOK function is executed. If any other key is pressed, the event is skipped to ensure standard behaviour.

Expanding and collapsing nodes using right and left arrow keys is standard behaviour in wxWidgets. So we don't need to write any extra code for this. I have tested this behaviour by building a sample wxApp in winXp. So if we add any sub-trees to the preferences dialog in the future, it will not be a problem.

Vidyashankar




------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel


[P3PrefsEnter2.patch]

? P3PrefsEnter2.patch
Index: src/prefs/PrefsDialog.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/prefs/PrefsDialog.cpp,v
retrieving revision 1.69
diff -u -r1.69 PrefsDialog.cpp
--- src/prefs/PrefsDialog.cpp 27 Jul 2009 15:36:37 -0000 1.69
+++ src/prefs/PrefsDialog.cpp 8 Sep 2009 18:31:06 -0000
@@ -67,6 +67,7 @@
 BEGIN_EVENT_TABLE(PrefsDialog, wxDialog)
    EVT_BUTTON(wxID_OK, PrefsDialog::OnOK)
    EVT_BUTTON(wxID_CANCEL, PrefsDialog::OnCancel)
+   EVT_TREE_KEY_DOWN(wxID_ANY, PrefsDialog::OnTreeKeyDown) // Handles key events when tree has focus
 END_EVENT_TABLE()
 
 PrefsDialog::PrefsDialog(wxWindow * parent)
@@ -163,6 +164,14 @@
    EndModal(false);
 }
 
+void PrefsDialog::OnTreeKeyDown(wxTreeEvent & event)
+{
+   if(event.GetKeyCode() == WXK_RETURN)
+      OnOK(event);
+   else
+      event.Skip(); // Ensure standard behavior when enter is not pressed
+}
+
 void PrefsDialog::OnOK(wxCommandEvent & event)
 {
    // Validate all pages first
Index: src/prefs/PrefsDialog.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/prefs/PrefsDialog.h,v
retrieving revision 1.10
diff -u -r1.10 PrefsDialog.h
--- src/prefs/PrefsDialog.h 4 Apr 2009 10:55:56 -0000 1.10
+++ src/prefs/PrefsDialog.h 8 Sep 2009 18:31:07 -0000
@@ -28,6 +28,7 @@
    void OnCategoryChange(wxCommandEvent & e);
    void OnOK(wxCommandEvent & e);
    void OnCancel(wxCommandEvent & e);
+   void OnTreeKeyDown(wxTreeEvent & e); // Used to dismiss the dialog when enter is pressed with focus on tree
 
    void SelectPageByName(wxString pageName);
    void ShowTempDirPage();


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Martyn Shaw-2

Re: Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left

Reply Threaded More More options
Print post
Permalink
In reply to this post by David Bailes-2


David Bailes wrote:
...
>> 2) We were discussing about using a text box (uneditable by the user)
>> instead of a list in the export multiple success dialog. But in screen
>> readers, when the uneditable text box has the focus, it says "edit
>> multiline" and reads out the first line in the text box. This is misleading
>> because the text control cannot be edited by the user. (I checked this by
>> building a sample wxApp and not in audacity).
>
> I'm not sure why it does this. I think I remember that Martyn had a
> similar problem to this on an earlier version of the Contrast tool.

I did have this problem and am just thinking about it again.  I would
appreciate any input.

For the result of a measurement in Contrast I am using a wxTextCtrl so
that it gets read out when you tab to it.  But then I capture key
strokes so that you can't edit it.  I also change the name of it
depending of whether audio has been measured or not ("No foreground
measured" or "Measured foreground level", similar for background).

I need to change the display of start and stop times and was thinking
about doing it in the same way.  Is there a better/standard way in wx
of displaying 'results' like this, whilst them still being accessible
to screen readers (and I appreciate that readers vary in quality)?

Thanks
Martyn

> David.
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> audacity-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Gale (Audacity Team)

Re: Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left

Reply Threaded More More options
Print post
Permalink
In reply to this post by Vidyashankar Vellal

| From Vidyashankar Vellal <[hidden email]>
| Wed, 9 Sep 2009 00:54:58 +0530
| Subject: [Audacity-devel] Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left

> I have attached a modified version of the patch for the preferences window.
> After digging a bit, I found that wxTreeCtrl has a built-in event called
> EVT_TREE_KEY_DOWN which is a wxTreeEvent. Unlike wxKeyEvent, this can
> propogate up the parent chain. I have used this in the patch. So there is no
> need for any extra event handlers or custom events.
>
> The patch is simple. When the enter key is pressed with the tree having the
> focus, the PrefsDialog::OnOK function is executed. If any other key is
> pressed, the event is skipped to ensure standard behaviour.
>
> Expanding and collapsing nodes using right and left arrow keys is standard
> behaviour in wxWidgets. So we don't need to write any extra code for this. I
> have tested this behaviour by building a sample wxApp in winXp. So if we add
> any sub-trees to the preferences dialog in the future, it will not be a
> problem.

Thanks, Vidyashankar.  I've applied the patch to the Windows
Nightly Build and it works fine for me.  Unless there are any
technical objections,  I propose to commit it.  

I think you're waiting some further input about the equivalent P4
problem with the Export Multiple success dialogue. I'll find the
e-mails and add my comments a bit later on. Anyone else interested
please also do so.

Does anything else on the Checklist take your fancy, or you can add
any suggestions about them?


Thanks very much.



Gale






------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel

P3PrefsEnter2.patch (2K) Download Attachment
Leland (Audacity Team)

Re: Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left

Reply Threaded More More options
Print post
Permalink
Gale Andrews wrote:

> | From Vidyashankar Vellal <[hidden email]>
> | Wed, 9 Sep 2009 00:54:58 +0530
> | Subject: [Audacity-devel] Patch for P3: Preferences Window: OK Button does not respond to Enter when a tab is selected in the left
>> I have attached a modified version of the patch for the preferences window.
>> After digging a bit, I found that wxTreeCtrl has a built-in event called
>> EVT_TREE_KEY_DOWN which is a wxTreeEvent. Unlike wxKeyEvent, this can
>> propogate up the parent chain. I have used this in the patch. So there is no
>> need for any extra event handlers or custom events.
>>
>> The patch is simple. When the enter key is pressed with the tree having the
>> focus, the PrefsDialog::OnOK function is executed. If any other key is
>> pressed, the event is skipped to ensure standard behaviour.
>>
>> Expanding and collapsing nodes using right and left arrow keys is standard
>> behaviour in wxWidgets. So we don't need to write any extra code for this. I
>> have tested this behaviour by building a sample wxApp in winXp. So if we add
>> any sub-trees to the preferences dialog in the future, it will not be a
>> problem.
>
>
> Thanks, Vidyashankar.  I've applied the patch to the Windows
> Nightly Build and it works fine for me.  Unless there are any
> technical objections,  I propose to commit it.  
>
Gale, you going to commit it or should I?

Leland

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
1 2 3