Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MFC OCX

Posted on 1998-07-16
4
Medium Priority
?
680 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

609 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