471,850 Members | 1,024 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,850 software developers and data experts.

SetFocus in Dialog Box


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(){

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.


I think it would be something really simply but I don't know? Any help would be greatly appreciated.
Aug 7 '06 #1
2 7221
9,065 Expert Mod 8TB
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 NeoPa | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.