Solved

Setting Focus

Posted on 1999-01-06
4
230 Views
Last Modified: 2013-11-20
I have an Edit control and a check box and the tab order is set in that order , i make a validation for the text entered in the edit box control and if the validation fails , i set the focus back to the edit control but the focus is not going to the edit control but to the check box since that is next to edit control in tab order , why is that ? and How can i set the focus back to the edit control ?
0
Comment
Question by:NaveenKumar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 

Author Comment

by:NaveenKumar
ID: 1327341
Edited text of question
0
 
LVL 4

Accepted Solution

by:
pagladasu earned 20 total points
ID: 1327342
Here is what you should do. Use classwizard to map the EN_KILLFOCUS of the edit control. Assuming that its ID value is IDC_EDIT1, use code something like this:

void CMyDlg::OnKillfocusEdit1()
{
      // TODO: Add your control notification handler code here
      UpdateData(TRUE);
      if(m_edit!="Hello") //m_edit is a CString variable associated with the control
            GetDlgItem(IDC_EDIT1)->SetFocus();
}

hope this helps
thanks
pagladasu
0
 

Author Comment

by:NaveenKumar
ID: 1327343
Thanx for ur answer , actually i am not making use of any wizards in my project , but manually writing the cpp and header codes and inserting it into the project , I have trapped the kill focus as you have said and the validation is done there itself and i have also set back the focus in Kill focus as you have mentioned but even after doing all this the focus is set on the check box and not on the edit control .
0
 
LVL 4

Expert Comment

by:pagladasu
ID: 1327344
Could you please post the code.
Email to:espical@hotmail.com
As far as the above code is concerned, I have tried it out, and it works.

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question