CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2004
    Posts
    1,361

    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?

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: Need help with Property Pages and Edit controls

    Just a guess, but try calling the SetFocus after calling the base class OnSetActive.

  3. #3
    Join Date
    Sep 2004
    Posts
    1,361

    Re: Need help with Property Pages and Edit controls

    Tried it and it didn't work.

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: Need help with Property Pages and Edit controls

    Quote Originally Posted by DeepT View Post
    Tried it and it didn't work.
    You didn't leave the return statement on the base class call did you?

  5. #5
    Join Date
    Sep 2004
    Posts
    1,361

    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

  6. #6
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: Need help with Property Pages and Edit controls

    Quote Originally Posted by DeepT View Post
    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.

  7. #7
    Join Date
    Sep 2004
    Posts
    1,361

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured