473,326 Members | 2,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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 7327
Banfa
9,065 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

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

Similar topics

4
by: Mad Scientist Jr | last post by:
i am trying to set focus to a specific control depending on the outcome of a validator control and it is not working. none of these methods are working to setfocus: 1....
8
by: Newsgroups | last post by:
Q: How many licks DOES it take to get to the center of a Tootsie Pop? err... on a more serious note: What is the VB.NET equivalent of the VB 6.0 "control.SetFocus()" event? Thanks in...
1
by: Haobing | last post by:
I embeded an flash activex control to a wxPanel inherited class 'MyPanel' using wxPython's MakeActiveXClass method, and 'MyPanel' only has flash control ;But when then dialog init,the focus is not...
0
by: MrsLeigh | last post by:
I have a datagrid on a web page. In the footer there is a field that should be recieve the focus, either at the start or after a button is clicked to insert the row that is being added in the...
2
by: hex | last post by:
I put function OnInitDialog in child dialog wich made by class CSecond: BOOL CSecond::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here m_ed.SetFocus();...
3
by: Jim Devenish | last post by:
In my application vehicles arrive and depart from a workshop. The ArrivalDate and the HandoverDate are each entered. Sometimes the person who should enter the arrival date forgets to do so. ...
4
by: =?Utf-8?B?am9zZXJhbW9uYnJhdm8=?= | last post by:
I use a CDialog with several controls and I want to set the focus in one of them , a CEdit, when an instance is created. The trouble is that I can get a pointer to the CEdit window, say p, but if I...
0
by: srinivasarao yarru | last post by:
hi sir, in access 2003 how we can use the setfocuse property(we have to lostfocuse from one field with in that we have to setfocuse in same field) i am using this code but not setfocuse...
5
agroover
by: agroover | last post by:
I can't seem to figure out how to get rid of the errors. I recieve the following error when I leave the Grade.SetFocus in my code... Microsoft Access can't move the focus to the control Grade ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.