Click here to Skip to main content
15,910,123 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Standalone in place CEdit Pin
Neville Franks12-Aug-03 3:09
Neville Franks12-Aug-03 3:09 
GeneralRe: Standalone in place CEdit Pin
Neville Franks12-Aug-03 3:35
Neville Franks12-Aug-03 3:35 
GeneralRe: Standalone in place CEdit Pin
jhwurmbach12-Aug-03 1:02
jhwurmbach12-Aug-03 1:02 
GeneralRe: Standalone in place CEdit Pin
Ravi Bhavnani12-Aug-03 2:34
professionalRavi Bhavnani12-Aug-03 2:34 
GeneralRe: Standalone in place CEdit Pin
Neville Franks12-Aug-03 2:47
Neville Franks12-Aug-03 2:47 
GeneralRe: Standalone in place CEdit Pin
igor196012-Aug-03 11:10
igor196012-Aug-03 11:10 
GeneralRe: Standalone in place CEdit Pin
Neville Franks12-Aug-03 11:18
Neville Franks12-Aug-03 11:18 
GeneralRe: Standalone in place CEdit Pin
igor196012-Aug-03 12:05
igor196012-Aug-03 12:05 
Actually it's not CControlBar -- it's CDialogBar restrction.
Here it is from Technical Note 31:

CDialogBar

A dialog bar is a control bar that contains standard Windows controls. It acts like a dialog in that it contains the controls and supports tabbing between them. It also acts like a dialog in that it uses a dialog template to represent the bar.

A CDialogBar is used for the print-preview toolbar, which contains standard pushbutton controls.

Using a CDialogBar is like using a CFormView. You must define a dialog template for the dialog bar and remove all the styles except WS_CHILD. Note that the dialog must not be visible.

The control notifications for a CDialogBar will be sent to the parent of the control bar (just like toolbar buttons).



Sure, you can have different methods of attacking and resolving that problem:

However, because it's your container application that specifically put that CEdit in CDialogBar, I would assume that the right way to do it, would be to place the code into App or Frame.
So, I would be looking into for example overloading PreTranslateMessage of App or Frame. Something like that:

BOOL CYourApp::PreTranslateMessage(MSG* pMsg)
{
if (CWinApp::PreTranslateAppMessage(pMsg))
return TRUE;
....
...
if(((pMsg->message == WM_KEYDOWN)||(pMsg->message == WM_KEYUP))&&
(pMsg->wParam == VK_RETURN)) // whatever you want here
{
char szClassName[32];
if((GetClassName(pMsg->hwnd, szClassName, 32))&&
(_stricmp(szClassName, "Edit") == 0))
{
if(::IsChild(hWndYourControlBarHandlerHere, pMsg->hwnd))
{
SendMessage(pMsg->hwnd, pMsg->message, pMsg->wParam, pMsg->lParam);
// or you may translate dispatch it right here -- up to you...
return TRUE;
}

}
....


Don't copy paste above though. I maybe wrong again (as usual).;P

Regards


"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
GeneralRe: Standalone in place CEdit Pin
HPSI12-Aug-03 2:42
HPSI12-Aug-03 2:42 
GeneralRe: Standalone in place CEdit Pin
Neville Franks12-Aug-03 2:52
Neville Franks12-Aug-03 2:52 
GeneralInternetQueryOption linking error Pin
si_6911-Aug-03 22:48
si_6911-Aug-03 22:48 
GeneralRe: InternetQueryOption linking error Pin
si_6911-Aug-03 22:58
si_6911-Aug-03 22:58 
GeneralRe: InternetQueryOption linking error Pin
Steve S12-Aug-03 0:41
Steve S12-Aug-03 0:41 
GeneralGroup Box - Change color border Pin
JensB11-Aug-03 22:43
JensB11-Aug-03 22:43 
GeneralRe: Group Box - Change color border Pin
Iain Clarke, Warrior Programmer11-Aug-03 23:08
Iain Clarke, Warrior Programmer11-Aug-03 23:08 
GeneralRe: Group Box - Change color border Pin
JensB11-Aug-03 23:44
JensB11-Aug-03 23:44 
Generall Pin
Anonymous11-Aug-03 22:31
Anonymous11-Aug-03 22:31 
GeneralRe: l Pin
Rickard Andersson2011-Aug-03 22:39
Rickard Andersson2011-Aug-03 22:39 
GeneralHelp in Picture Pin
henli11-Aug-03 22:20
henli11-Aug-03 22:20 
GeneralRe: Help in Picture Pin
Steve S12-Aug-03 0:31
Steve S12-Aug-03 0:31 
GeneralRe: Help in Picture Pin
henli12-Aug-03 5:03
henli12-Aug-03 5:03 
QuestionIs there free MCSD materials, questions (70-015)? Pin
vgrigor11-Aug-03 22:08
vgrigor11-Aug-03 22:08 
GeneralPopup menu question Pin
Cedric Moonen11-Aug-03 22:06
Cedric Moonen11-Aug-03 22:06 
GeneralRe: Popup menu question Pin
HPSI11-Aug-03 22:25
HPSI11-Aug-03 22:25 
GeneralRe: Popup menu question Pin
Cedric Moonen11-Aug-03 22:46
Cedric Moonen11-Aug-03 22:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.