Need help with Property Pages and Edit controls
I have two problems.
1. When a certain property page is shown, I want a particular edit box to have focus. I am not sure how to do this, but I tried:
Code:
BOOL PropPageHello::OnSetActive()
{
EditUserName.SetFocus();
return CPropertyPage::OnSetActive();
}
I put in break points and it definitely executes that each time it is first displayed.
2. When I push enter in one edit box I want the next edit box to get focus and become active. I tried the following on the property page:
Code:
void PropPageHello::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
CPropertyPage::OnKeyDown(nChar, nRepCnt, nFlags);
}
If you put a break point on the only executable line there, it never gets hit. This is how you (or at least one way) to do it in a normal dialog, but it doesn't seem to work for property sheets. How do you do it for property pages and sheets?
Re: Need help with Property Pages and Edit controls
Just a guess, but try calling the SetFocus after calling the base class OnSetActive.
Re: Need help with Property Pages and Edit controls
Tried it and it didn't work.
Re: Need help with Property Pages and Edit controls
Quote:
Originally Posted by
DeepT
Tried it and it didn't work.
You didn't leave the return statement on the base class call did you?
Re: Need help with Property Pages and Edit controls
I did :
Code:
BOOL PropPageHello::OnSetActive()
{
BOOL Ret = CPropertyPage::OnSetActive();
EditUserName.SetFocus();
return Ret;
}
Hmm, no responses on question 2 :(
Re: Need help with Property Pages and Edit controls
Quote:
Originally Posted by
DeepT
I did :
Code:
BOOL PropPageHello::OnSetActive()
{
BOOL Ret = CPropertyPage::OnSetActive();
EditUserName.SetFocus();
return Ret;
}
Hmm, no responses on question 2 :(
I'd probably try to intercept it with PreTranslateMessage.
Re: Need help with Property Pages and Edit controls
I found the answer in this Microsoft article:
http://support.microsoft.com/kb/148388
I got lucky with my google fu. Now to try and find the answer to the 2nd question.