Anthony Zhang
May 10th, 1999, 06:47 AM
Could somebody give me some ideas how to implement copy, cut and paste for edit controls inside dialog boxes in Visual C++ 5.0? Any information would be appreciated.
Thanks in advance.
Thanks in advance.
|
Click to See Complete Forum and Search --> : How to implement copy, cut and paste for edit controls in a dialog box in VC++5.0 Anthony Zhang May 10th, 1999, 06:47 AM Could somebody give me some ideas how to implement copy, cut and paste for edit controls inside dialog boxes in Visual C++ 5.0? Any information would be appreciated. Thanks in advance. Jason Teagle May 10th, 1999, 07:22 AM CEdit implements Cut(), Copy() Undo() and Paste() methods. For a main window's edit box you would simply have to trap the relevant WM_COMMAND message for the standard menu IDs 'ID_EDIT_XXX' (i.e., provide a handler for these IDs in your program using the ClassWizard), and then call the above methods for the edit box with the focus. The shortcut keys will then work. The same should work for a dialogue box - try implementing a handler for the above ID_EDIT_XXX messages within your dialogue class, and see if they work. Anthony Zhang May 12th, 1999, 03:14 AM Hi Jason, Thanks for your reply to my question. I have tried what you suggested, but it didn't seem to work in a CRecordView. Actually my original question was wrong, edit controls in dialog boxes works fine with copy, cut and paste. My problem is with copy, cut and paste in edit controls inside a CRecordView or CFormView. Regards, Anthony Zhang Jason Teagle May 12th, 1999, 03:36 AM Ah. I wondered why it wouldn't work. I have never used CRecordView, so I'm not sure; but I would guess that as the controls are 'bound' to database records (I think that's correct), CRecordView is overriding some of the behaviour normally found in them. You might try overriding your CRecordView's PreTranslateMessage() and allow it to pass on the particular messages that don't seem to be getting through - the MFC framework obviously doesn't expect these features to be necessary. No idea why, though. I hope that helps. Anthony Zhang May 12th, 1999, 10:09 AM Hi, Jason, Thanks a lot for your help. I have found out why it did not work. The problem is that I did not specifically define a CEdit variable for each of the edit control. Once I define them, it works fine. Thanks, Anthony codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |