|
-
April 3rd, 1999, 03:11 AM
#1
CCombbox Control IDs
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
-
April 3rd, 1999, 02:51 PM
#2
Re: CCombbox Control IDs
Can you at least get the correct window pointer to the combo box?
What if you did something like this:
CMyView::PretranslateMessage()
{
int nCtrlID = 0;
CWnd* pWnd;
.
.
case VK_RETURN:
pWnd = GetFocus();
if (pWnd == GetDlgItem(IDC_COMBO_CARRIER))
{
OnProcessCtr();
}
else
{
nCtrlID = GetFocus()->GetDlgCtrlID();
switch(nCtrlID)
{
case IDC_EDIT_AGENT:
case IDC_EDIT_LINE:
OnProcessCtr();
break;
case IDC_COMBO_LENGTH:
case IDC_EDIT_CTR:
case IDC_EDIT_LINE:
OnProcessCar();
.
.
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|