[wx-dev] [ wxwindows-Patches-1931423 ] Char hook - Edit labels in dialogs

SourceForge.net noreply at sourceforge.net
Mon May 5 07:43:06 PDT 2008


Patches item #1931423, was opened at 2008-04-01 18:18
Message generated for change (Settings changed) made by arst
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1931423&group_id=9863

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Common
Group: new feature
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: arst (arst)
>Assigned to: Vadim Zeitlin (vadz)
Summary: Char hook - Edit labels in dialogs

Initial Comment:
After some time, I've completed the patch to enable label editing from tree/list and other controls when used from inside a dialog. 

Background info - (Discussion Vadim, ATS)
http://www.nabble.com/Continued:-Popup-edit-in-a-dialog-td15994114.html
http://article.gmane.org/gmane.comp.lib.wxwindows.general/59141

The patch implements the solution disucussed above. It's been running for some 10 days with no problems. 

EVT_CHAR_HOOK event generation has been changed for these platforms:
- wxGTK: Tested
- wxMSW: Tested
- wxMAC - carbon - Not tested
- wxMOTIF - Not tested
(Have not done: OS/2, Palm, Universal/DFB, more?)

These controls are modified:
1 - wxListCtrl 
  - (Generic, MSW, mac) 
  - tested

2 - wxTreeCtrl 
  - Generic 
  - not tested but very similar to 1

3 - wxDataViewCtrl 
  - Generic
  - not tested but similar to 1.

Maybe someone could give it a test on MAC/Carbon. Also, for DataViewVtrl, it would be nice if it could be checked (Robert?). Motif? 

The patch touches almost 10 files and applies cleanly... not for very long.

I noted that the change to each control is almost identical, and a more efficient approach would be to have a class:

  class wxPopupTextCtrl : public wxTextCtrl { ... }

which handled the EVT_CHAR_HOOK event. Each control would be simplified both with regards to label editing and CHAR_HOOK. That's outside the scope of this patch though. 


Synching with continuously modified SVN has been the biggest problem! I updated all affected files from SVN yesterday.

Regards
// ATS.


----------------------------------------------------------------------

Comment By: arst (arst)
Date: 2008-04-22 14:24

Message:
Logged In: YES 
user_id=1718604
Originator: YES

What you suggest would not work. A combo box, or a embedded text control
would take EVT_CHAR. Then EVT_CHAR_HOOK would never reach the dialog. You'd
not be able to close the dialog with ESCAPE when the tex ctrl / combo has
focus.

Also, on MSW, EVT_CHAR_HOOK is generated from a different native message
than EVT_KEY_DOWN and EVT_CHAR.

Before implementing this I suggested a simpler approach (basically
something like wxWindow::wxCaptureKeyboard()). But after some discussing
and analyzing we went for this version. When listening to keys from a
wxFrame, one can be quite specific with what one would filter out in
EVT_CHAR_HOOK. 

The current patch works, fulfills the discussion leading up to it and is
now tested for around 5 weeks. Also, with the suggested wxPopupTextCtrl,
one could centralize EVT_CHAR_HOOK for label editing into one place
(currently almost identical classes does this for wxTreeCtrl, wxListCtrl
and wxDataViewCtrl). 

Regards
// ATS.

----------------------------------------------------------------------

Comment By: Robert Roebling (roebling)
Date: 2008-04-22 10:21

Message:
Logged In: YES 
user_id=77100
Originator: NO

Shouldn't we simply change the order of event and send the char event to
the text control first and if it is not handled there, send it further down
as a CHAR_HOOK events? The solution of your patch looks a little clumsy to
me and requires changes to all the control instead of offering a single
mechanism.

----------------------------------------------------------------------

Comment By: arst (arst)
Date: 2008-04-22 07:03

Message:
Logged In: YES 
user_id=1718604
Originator: YES

Hello, 

Original discussion was with Vadim, but that was some 4 weeks ago now.

Brief description:

1 - Put a wxListBox / wxTreeCtrl / wxDataViewCtrl inside a dialog.
2 - Call ShowModal()
3 - Then click a label and start edit (popup edit control).
4 - Now hit cancel. Instead of just the popup edit control closing, 
the whole dialog closes. Not what one would expect.

The patch reimplements the way wxEVT_CHAR_HOOK i handled (for MSW, 
GTK, MAC-Carbon & Motif). Then, this situation can be discovered and
one can edit labels and ESCAPE without dialog closing. 

There are easier ways of solving the problem, but we agreed on this 
more thorough approach.

Regards
// ATS

----------------------------------------------------------------------

Comment By: Robert Roebling (roebling)
Date: 2008-04-21 20:58

Message:
Logged In: YES 
user_id=77100
Originator: NO

Could you just briefly describe the problem again? I don't understand it
from the code or the linked mail.

----------------------------------------------------------------------

Comment By: arst (arst)
Date: 2008-04-05 14:05

Message:
Logged In: YES 
user_id=1718604
Originator: YES

The file wx/event.h (wxKeyEvent) is also touched by the patch.
Add to original patch file.

Regards
// ATS


File Added: char-hook-event.p0

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1931423&group_id=9863


More information about the wx-dev mailing list