Hi Jason 

Well to be honest with you I tried this before but all
I get is "debug assertion failed" and it stops at:

_AFXCMN_INLINE int CTabCtrl::SetCurSel(int nItem)
        { ASSERT(::IsWindow(m_hWnd)); return (int)::SendMessage(m_hWnd,
TCM_SETCURSEL, nItem, 0L); }

in the include file AFXCMN.INL, there  m_hWnd= 0x000000, nItem = 1.


WINDOWPLACEMENT m;
((CMainFrame*)((CCmApp
*)AfxGetApp())->GetMainWnd())->GetWindowPlacement(&m);
if (m.showCmd == SW_SHOWMINIMIZED)
{
        m.showCmd = SW_SHOWMAXIMIZED;
        ((CMainFrame*)((CCmApp
*)AfxGetApp())->GetMainWnd())->SetWindowPlacement(&m);

        CTabCtrl m_TabControl;
        int tab_index =1;
        m_TabControl.SetCurSel(tab_index);
}




-----Original Message-----
From: Jason Teagle [mailto:[EMAIL PROTECTED]
Sent: den 9 mars 2004 17:53
To: [EMAIL PROTECTED]
Subject: RE: [msvc] Tab controller


> How can I select a tab controller automatically? My Application contains 5
> tab controls,
> I want to as soon as the application has been maximized
> (assume that you have minimized the application) the first tab control be
> selected and visualizes to the user.

If I understand your question correctly, you need to set the focus to that
place. However, I don't believe it's possible to set focus to a tab control
itself; you must set the focus to one of the controls on the page shown by
the tab control. What you can do, of course, is switch tabs on the tab
control if you need to, using

m_TabControl.SetCurSel(tab_index);

In fact, by looking that little thing up, I stand corrected: you CAN put the
focus on a tab, using

m_TabControl.SetCurFocus(tab_index);

(the above assumes you are using a CTabCtrl or a class derived from it)

If you want to know how to tell when your application has been restored from
minimized, add a handler for WM_SIZE to the window's class and look for
nType being SIZE_RESTORED in the OnSize() method the handler generates.

If this does not answer your question properly, please give us more detailed
information.

--
Jason Teagle
[EMAIL PROTECTED]



_______________________________________________
msvc mailing list
[EMAIL PROTECTED]
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for
subscription changes, and list archive.

** Confidentiality Statement and Disclaimer **
Proprietary or confidential information belonging to Gambro AB or to one of
its affiliated companies may be contained in this message. If you are not
the addressee indicated in this message (or responsible for the delivery of
the message to such person), please do not copy or deliver this message to
anyone. In such case, please destroy this message and notify the sender by
reply e-mail. Please advise the sender immediately if you or your employer
do not consent to Internet e-mail for messages of this kind.
Opinions, conclusions and other information in this message that pertain to
the sender's employer and its products and services represent the opinion of
the sender and do not necessarily represent or reflect the views and
opinions of the employer. 
** End of Statement **


Reply via email to