Link to home
Start Free TrialLog in
Avatar of DJ_AM_Juicebox
DJ_AM_Juicebox

asked on

keyboard shortcuts for CEdit

Hi,
I have a standard CDialog derived class with some CEdits on it. When I right click one of the edit controls, I get the standard copy/cut/paste menu, and it works fine.

What doesn't work is if I have the edit control hilighted and use the keyboard shortcut ctrl + c. (shortcut for cut and paste don't work either). Is there something special I need to do to get the keyboard shortcuts to work?

Thanks
Avatar of mahesh1402
mahesh1402
Flag of India image

>>What doesn't work is if I have the edit control hilighted

When actually thats not working ? when your edit control have focus and text is selected ? As you said not working is Ctrl+C..so CUT ie Ctrl+X is working on your edit box ?

-MAHESH
>>shortcut for cut and paste don't work either

When exactly you cannot use CUT, COPY , PASTE and under which situation same are working?

-MAHESH
Avatar of DJ_AM_Juicebox
DJ_AM_Juicebox

ASKER

yeah i can't do any of those (CUT, COPY , PASTE). via the KEYBOARD shortcuts.

Actually these are CEdits that I created myself on a CWnd - CEdits created by the wizard on a CDialog derived window are working fine. Is there a specific flag I need to set to get the keyboard shortcuts to work for them? Here's how I'm creating them:

CEdit m_Edit;
m_Edit.Create(WS_CHILD | WS_BORDER, CRect(0,0,23,100), this, SOME_RESOURCE_ID);

Thanks
you have standard dialog or MDI / SDI application with view ?

MDI/SDI :
http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B145616

-MAHESH
yes it's an MDI app.
>>yes it's an MDI app.

Then follow guidelines here with CEdit::Copy(), CEdit::Cut(), CEdit::Paste()
http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B145616

-MAHESH

ok I read the article, but what is the function defintiion that I should add to the header and message map for:

    OnUpdateNeedSel(CCmdUI* pCmdUI)
    OnUpdateNeedClip(CCmdUI* pCmdUI)

I'm not sure how to add those and the article does not dicuss that.

Thanks
do you have your Edit controls on ForView ?

-MAHESH
well they're created on a CWnd derived class,

Thanks
Actually they are handler for ID_EDIT_COPY , ID_EDIT_CUT & ID_EDIT_PASTE

ON_UPDATE_COMMAND_UI (ID_EDIT_CUT, OnUpdateNeedSel)
ON_UPDATE_COMMAND_UI (ID_EDIT_COPY, OnUpdateNeedSel)

-MAHESH

what does that mean, I don't understand?
ok before that 1st tell me do you have accelerators defined like :

https://www.experts-exchange.com/questions/20131428/Using-Ctrl-X-Ctrl-C-and-Ctrl-V-with-CHtmlView.html

-MAHESH
ASKER CERTIFIED SOLUTION
Avatar of mahesh1402
mahesh1402
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial