focus in edit control
-
i am using dialog ,in that i have an edit control,when ever my dialog displays cursor must be in the edit control,plz help me............
-
i am using dialog ,in that i have an edit control,when ever my dialog displays cursor must be in the edit control,plz help me............
-
You can call GotoDlgCtrl() API for that edit to set the focus. If it is in OnInitDialog, you should return FALSE.
- NS -
ok fine,if it in another function ,wts the processs............
-
ok fine,if it in another function ,wts the processs............
-
i am using dialog ,in that i have an edit control,when ever my dialog displays cursor must be in the edit control,plz help me............
Set the "Tab stop" for the edit control as 1. For doing this click Ctrl+D on the resource view of the dialog. Set the edit control tab stop as 1. It is the simplest way to solve your problem.:)
Sreedhar DV
-
i am using dialog ,in that i have an edit control,when ever my dialog displays cursor must be in the edit control,plz help me............
add a member variable for that edit box e.g. "m_deEditBox" using the class wizard and set the category as a control and the variable type should change to be automaticaly CEdit. Wherever you want to receive focus use the SetFocus() and that should do the trick e.g. : m_deEditBox.SetFocus(); Only make sure m_deEditBox is visible within the class you are using! :)
Wamuti: Any man can be an island, but islands to need water around them! Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
-
tried setting it to a member of CEdit(The edit box itself ) but GoToDlgCtrl is not a member of CEdit.
Wamuti: Any man can be an island, but islands to need water around them! Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
-
add a member variable for that edit box e.g. "m_deEditBox" using the class wizard and set the category as a control and the variable type should change to be automaticaly CEdit. Wherever you want to receive focus use the SetFocus() and that should do the trick e.g. : m_deEditBox.SetFocus(); Only make sure m_deEditBox is visible within the class you are using! :)
Wamuti: Any man can be an island, but islands to need water around them! Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
-
tried setting it to a member of CEdit(The edit box itself ) but GoToDlgCtrl is not a member of CEdit.
Wamuti: Any man can be an island, but islands to need water around them! Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
-
First, Thanks for the correction. Second, sorry this is long but here goes; When i tested SetFocus(), i placed it in two buttons as: void CSetfocusDlg::OnBfirst() //first button { // TODO: Add your control notification handler code here m_deOne.SetFocus(); } void CSetfocusDlg::OnBsecond() //second button { // TODO: Add your control notification handler code here m_deTwo.SetFocus(); } and it worked just fine. But if i am getting it right, if there is a button in a dialog, SetFocus() is reserved for the default push button, right? This means that even if i put m_editControl.SetFocus() in OnInitDialog(), i would still not get the desired effect of setting the cursor to the Edit control(what i understand from the site you directed me and practically i have tried, so i was very wrong indeed). Ofcourse it makes sense to use the WM_NEXTDLGCTL but i cant get the message in the class wizard. Then how do i code the handler? Please help!:sigh:
Wamuti: Any man can be an island, but islands to need water around them! Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
-
i am using dialog ,in that i have an edit control,when ever my dialog displays cursor must be in the edit control,plz help me............
Oops:doh: sorry, using SetFocus() won't work. But i am learning. Thanks for understanding.
Wamuti: Any man can be an island, but islands to need water around them! Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.