Edit control in a WTL CTreeViewCtrlEx problem 
Author Message
 Edit control in a WTL CTreeViewCtrlEx problem

Edit Control Cut, Copy, Paste, and Clear Operations

Does anyone know why my edit control does not respond to a ctrl+c, ctrl+v,
or ctrl+p during Tree View Label Editing?  The edit control responds to
Enter, characters, and right click context menu commands.  The only thing
that I do to the edit control is limit the number of characters.

Using Spy++ with Clipboard, Keyboard, and Edit Fields checked, if I left
click on an Item that has the focus I get:
<00001> 002B02DA S EM_SETLIMITTEXT cbMax:259
<00002> 002B02DA R EM_SETLIMITTEXT
<00003> 002B02DA S EM_SETSEL nStart:0 nEnd:0
<00004> 002B02DA R EM_SETSEL
<00005> 002B02DA S ..EM_SETLIMITTEXT cbMax:127
<00006> 002B02DA R ..EM_SETLIMITTEXT
<00007> 002B02DA S EM_GETRECT lprc:0012F2FC
<00008> 002B02DA R EM_GETRECT lprc:0012F2FC (5,2)-(16379,15)
<00009> 002B02DA S EM_SETSEL nStart:-1 nEnd:-1 (clear selection)
<00010> 002B02DA R EM_SETSEL
<00011> 002B02DA S EM_SETSEL nStart:0 nEnd:-1 (select all text)
<00012> 002B02DA R EM_SETSEL
<00013> 002B02DA P WM_KEYDOWN nVirtKey:VK_CONTROL cRepeat:1 ScanCode:1D
fExtended:0 fAltDown:0 fRepeat:0 fUp:0
<00014> 002B02DA P WM_KEYDOWN nVirtKey:'C' cRepeat:1 ScanCode:2E fExtended:0
fAltDown:0 fRepeat:0 fUp:0
<00015> 002B02DA P WM_KEYUP nVirtKey:'C' cRepeat:1 ScanCode:2E fExtended:0
fAltDown:0 fRepeat:1 fUp:1
<00016> 002B02DA P WM_KEYUP nVirtKey:VK_CONTROL cRepeat:1 ScanCode:1D
fExtended:0 fAltDown:0 fRepeat:1 fUp:1

 I am using an tree control as follows,

class CTreeScrollView : public CWindowImpl<CTreeScrollView,
CTreeViewCtrlEx>,
      public CScrollImpl<CTreeScrollView>

If you look at the MSDN project CmnCtrl1.dsw,  you will see the
functionality that I am looking for, except that sample does not respond to
an Enter key properly.
Using Spy++ on this app I get three extra messages.

<00011> 00090280 P WM_KEYDOWN nVirtKey:VK_CONTROL cRepeat:1 ScanCode:1D
fExtended:0 fAltDown:0 fRepeat:0 fUp:0
<00012> 00090280 P WM_KEYDOWN nVirtKey:'C' cRepeat:1 ScanCode:2E fExtended:0
fAltDown:0 fRepeat:0 fUp:0
<00013> 00090280 P WM_CHAR chCharCode:' ' (3) cRepeat:1 ScanCode:2E
fExtended:0 fAltDown:0 fRepeat:0 fUp:0
<00014> 00090280 S WM_COPY
<00015> 00090280 R WM_COPY
<00016> 00090280 P WM_KEYUP nVirtKey:'C' cRepeat:1 ScanCode:2E fExtended:0
fAltDown:0 fRepeat:1 fUp:1
<00017> 00090280 P WM_KEYUP nVirtKey:VK_CONTROL cRepeat:1 ScanCode:1D
fExtended:0 fAltDown:0 fRepeat:1 fUp:1

I wasn't sure wether to post here or somewhere else. ?



Wed, 02 Jun 2004 02:48:46 GMT  
 Edit control in a WTL CTreeViewCtrlEx problem

Quote:
> Edit Control Cut, Copy, Paste, and Clear Operations

> Does anyone know why my edit control does not respond to a ctrl+c, ctrl+v,
> or ctrl+p during Tree View Label Editing?  The edit control responds

are you "eating" these shortcuts from your global accelerator table?
(i.e. do you have Ctrl+C etc in your accelerator resources?)
These would be translated to their equivalent commands in the main message
loop so the edit control will never see them

--------------------
2xExplorer R7xx
http://www.ps.ic.ac.uk/~umeca74



Sun, 06 Jun 2004 00:37:00 GMT  
 Edit control in a WTL CTreeViewCtrlEx problem
nikos

Hi.  I was able to fix this problem as a result of a similar suggestion from
Sandi Spires at     http://groups.yahoo.com/group/wtl/.  My solution was to
map the commands to a CTreeScrollView class function from the CMainFrame
class by adding the following Msg Map handlers:

  COMMAND_ID_HANDLER_EX(ID_EDIT_CUT, m_view.DoEditHotKey)
  COMMAND_ID_HANDLER_EX(ID_EDIT_COPY, m_view.DoEditHotKey)
  COMMAND_ID_HANDLER_EX(ID_EDIT_PASTE, m_view.DoEditHotKey)

And to the CTreeScrollView class I added the following function:

 void DoEditHotKey(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/)
 {
  if (m_bEditBoxActive) // flag set for TVN_BEGINLABELEDIT and cleared with
TVN_ENDLABELEDIT
  {
   switch(wID)
   {
   case ID_EDIT_CUT:
    {
     GetEditControl().Cut();
     break;
    }
   case ID_EDIT_COPY:
    {
     GetEditControl().Copy();
     break;
    }
   case ID_EDIT_PASTE:
    {
     GetEditControl().Paste();
     break;
    }
   }
  }
  return;

 }

I did not have Spy++ set to filter for WM_COMMAND so I missed the fact that
the Main frame was receiving them and not doing anything with them.  There
is probably a better way but I could not understand why the edit control was
receiving the ctrl+c and not processing them normally or why the parents
were not routing them to the edit control.


Quote:


> > Edit Control Cut, Copy, Paste, and Clear Operations

> > Does anyone know why my edit control does not respond to a ctrl+c,
ctrl+v,
> > or ctrl+p during Tree View Label Editing?  The edit control responds

> are you "eating" these shortcuts from your global accelerator table?
> (i.e. do you have Ctrl+C etc in your accelerator resources?)
> These would be translated to their equivalent commands in the main message
> loop so the edit control will never see them

> --------------------
> 2xExplorer R7xx
> http://www.ps.ic.ac.uk/~umeca74



Mon, 07 Jun 2004 02:58:23 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. WTL - CTreeViewCtrlEx - EditLabel

2. WTL edit controls in COM controls and beeps

3. Edit Control...Edit Control...Edit Control...Edit Control...Edit Control...

4. problems while programming an edit(not use edit control)

5. WTL - Very new to WTL - Trying to insert new COM object in WTL

6. Masked Edit Control and Remote data control problem

7. richedit control and edit control problem

8. Problem: Spin Control always selects all text in edit control

9. Edit Control---- Edit control ----------------------

10. Rich Edit Control Printing Problem (like the print preview problem)

11. Using Rich Edit Control or ip address control in a composite control

12. Problem with add member variable to edit control

 

 
Powered by phpBB® Forum Software