?
Solved

MFC OCX

Posted on 1998-07-16
4
Medium Priority
?
673 Views
Last Modified: 2013-11-20
I'm building an ActiveX control which contains three MFC common controls, two of which are to be tab stops.  If it matters, the three controls are a CStatic, a CEdit and a CButton.  I've got the drawing/painting code down fine, looks great, but it won't correctly handle the tab stops.  If I take the control into VB and embed it onto a form and add a VB command button, the focus is initially on my edit control, press tab, it moves to the VB command button, press tab again and all you get is a beep, no change in focus.  I've set the properties up in VB to make my OCX a tab stop, and set it's tab order.  I've made sure that in VC each of the sub-controls are tabstops as well.  What gives?
0
Comment
Question by:rayb
[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
 
LVL 2

Author Comment

by:rayb
ID: 1319317
Edited text of question
0
 
LVL 7

Accepted Solution

by:
psdavis earned 80 total points
ID: 1319318
It's probably going to be related to the same type of tab-control problem that you will encounter when adding controls to a view.  If you can get your hands on MFC Developer's Workshop by Frank Crockett, he's got an article about "Tabbing Between Child Window Controls in a Non-Dialog box view".


He basically handles the WM_CHAR and will post a WM_SWITCHFOCUS (user defined) message if the tab key is pressed.

He's got

afx_msg LRESULT OnSwitchFocus( WPARAM wParam, LPARAM lParam )
{
CWnd* pFocusWnd = (CWnd*) wparam;
CWnd* pNextWnd = pFocusWnd->GetNextWindow( );

if( ! pNextWnd )
   pNextWnd = GetWindow( GW_CHILD );

if( pNextWnd )
{
   pNextWnd->SetFocus( );
   return 0L;
}

AfxMessageBox( "error... " );

return (LRESULT) 0;

Hope this helps!
0
 
LVL 2

Author Comment

by:rayb
ID: 1319319
Thanks!  Unfortunately, I've got to move on to another project immediately, so I can't check this out.  But I give you the points anyway as you provided good looking code and pointed out some reference material.
Thank you.
0
 
LVL 7

Expert Comment

by:psdavis
ID: 1319320
Thanks, give me a yell if it doesn't work and I'll try the same here.

Phillip

0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

752 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