Tab key press 
Author Message
 Tab key press

Hi,

I am writing a grid control in ATL 3.0 which uses a single edit control to
access the current cell. The edit control has been created using
CContainedWindow.

I have the following message handlers implemented:
 MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)
 MESSAGE_HANDLER(WM_SYSKEYDOWN, OnSysKeyDown)
 MESSAGE_HANDLER(WM_SYSCOMMAND, OnSysCommand)

However, none of them are receiving the "Tab" key press. My control is on a
VB form and whenever I press the tab key, VB shifts focus to the next
control. How can I trap the Tab key in my grid control (I want it to move
the user the the next grid cell).

Thanks for your help,
Chris.



Fri, 20 Feb 2004 19:18:34 GMT  
 Tab key press
Hi, when you use Tab key to navigate between controls on your VB form, the
TranslateAccelerator() function of your ATL control is called.

IOleInPlaceActiveObjectImpl::TranslateAccelerator() is called first. This
function will call IOleControlSite::TranslateAccelerator() by default.
IOleControlSite::TranslateAccelerator() is the very function that
implements Tab navigation between controls on your form. So, if you don't
want the default tab navigation feature, just override
IOleInPlaceActiveObjectImpl::TranslateAccelerator() in your ATL projects,
like follows.

class ATL_NO_VTABLE CTestFull:
                  ...........
                 public IOleInPlaceActiveObjectImpl(CTestFull),
                  ..........
{

     .........
     STDMETHOD(TranslateAccelerator(LPMSG lpmsg)
     {
       //write code here to implement the feature you want.
       return S_OK;

      }

Hope this helps.

Thanks,
Kelton



Sat, 21 Feb 2004 13:31:49 GMT  
 Tab key press
For more on this see
http://www.microsoft.com/mind/defaulttop.asp?page=/mind/0499/faq/faq0...
&nav=/mind/0499/inthisissuecolumns0499.htm

cheers,
dave


Quote:
> Hi, when you use Tab key to navigate between controls on your VB form, the
> TranslateAccelerator() function of your ATL control is called.

> IOleInPlaceActiveObjectImpl::TranslateAccelerator() is called first. This
> function will call IOleControlSite::TranslateAccelerator() by default.
> IOleControlSite::TranslateAccelerator() is the very function that
> implements Tab navigation between controls on your form. So, if you don't
> want the default tab navigation feature, just override
> IOleInPlaceActiveObjectImpl::TranslateAccelerator() in your ATL projects,
> like follows.

> class ATL_NO_VTABLE CTestFull:
>                   ...........
>                  public IOleInPlaceActiveObjectImpl(CTestFull),
>                   ..........
> {

>      .........
>      STDMETHOD(TranslateAccelerator(LPMSG lpmsg)
>      {
>        //write code here to implement the feature you want.
>        return S_OK;

>       }

> Hope this helps.

> Thanks,
> Kelton



Tue, 24 Feb 2004 07:22:03 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Handling the TAB key press

2. Add Space while pressing Tab Key

3. Cannot press tab to move to a tab control after using WS_EX_CONTROLPARENT

4. Left Shift Key OR Right Shift key is pressed

5. On Key? , Key press

6. On Key? , Key press

7. Tab key to tab between controls does not work properly

8. Tab Control Ctrl-Tab-Keys

9. tab key not tabbing in my dialog

10. Enter Key must work as Tab Key do

11. Replace Tab key with Enter key

12. Enter Key acts as Tab Key ?

 

 
Powered by phpBB® Forum Software