468,513 Members | 1,785 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,513 developers. It's quick & easy.

SetFocus in Dialog Box

Hi,

I am trying to set the focus in a dialog box (VariableDlg) to a specific edit box (IDC_EDIT17, double m_temp) when a selection is made from a list box (List 1), using VC++. I have used the code below;

// edit box variable
double m_temp;

void VariableDlg::OnSelchangeList1(){
....
m_temp.SetFocus();
}

but this gives the following compilation error - error C2228: left of '.SetFocus' must have class/struct/union type

So I then tried this->m_temp.SetFocus(); but it gives the same error.

I sent the message below but this only places the cursor in the edit box where ideally I would like it to highlight the text in the edit box.

SendDlgItemMessage(IDC_EDIT17, WM_SETFOCUS, NULL, NULL);

I think it would be something really simply but I don't know? Any help would be greatly appreciated.
Thankx
Aug 7 '06 #1
2 7101
Banfa
9,056 Expert Mod 8TB
Look up WM_SETSEL
Aug 7 '06 #2
the error is coming because you are trying to use a double variable like a structure.
You need to declare a variable of type CEdit. You can do so by using class wizard. Only then you will be able to make use of Edit box functions.
Nov 12 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Mad Scientist Jr | last post: by
8 posts views Thread by Newsgroups | last post: by
reply views Thread by MrsLeigh | last post: by
2 posts views Thread by hex | last post: by
3 posts views Thread by Jim Devenish | last post: by
4 posts views Thread by =?Utf-8?B?am9zZXJhbW9uYnJhdm8=?= | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.