April 3rd, 1999, 02:11 AM
I am writing an app where i want to process the enter key diffently depending on which controls in my CFormView have the focus. What I have so far is an override of PretranslateMessage for the view that catches the enter key, which has a "switch" statement with control ids listed as "case" statements. For example,
CMyView::PretranslateMessage()
{
int nCtrlID = 0;
.
.
case VK_RETURN:
nCtrlID = GetFocus()->GetDlgCtrlID();
switch(nCtrlID)
{
case IDC_COMBO_CARRIER:
case IDC_EDIT_AGENT:
case IDC_EDIT_LINE:
OnProcessCtr();
break;
case IDC_COMBO_LENGTH:
case IDC_EDIT_CTR:
case IDC_EDIT_LINE:
OnProcessCar();
.
.
}
The problem is that the comboboxes do not return there respective control IDs.
I have tried all kinds of #@#$ to figure out what is going to no avail. Any
ideas on how to get control ids for comboboxes or another way to do what I
am trying to do.
Thanx.
JP
CMyView::PretranslateMessage()
{
int nCtrlID = 0;
.
.
case VK_RETURN:
nCtrlID = GetFocus()->GetDlgCtrlID();
switch(nCtrlID)
{
case IDC_COMBO_CARRIER:
case IDC_EDIT_AGENT:
case IDC_EDIT_LINE:
OnProcessCtr();
break;
case IDC_COMBO_LENGTH:
case IDC_EDIT_CTR:
case IDC_EDIT_LINE:
OnProcessCar();
.
.
}
The problem is that the comboboxes do not return there respective control IDs.
I have tried all kinds of #@#$ to figure out what is going to no avail. Any
ideas on how to get control ids for comboboxes or another way to do what I
am trying to do.
Thanx.
JP