Click here to Skip to main content
16,020,253 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have query regarding the VB Code as mentioned below:

tabMain_Click(PreviousTab As Integer)

in vb there is parameter i.e previous tab which shows some value by default as my tab is fixed to 1 it should show always zero but it is showing some times different values in vb.

basically my doubt is how to get the previous tab index in mfc as olny have current selection or getavtivepageindex ?

What I have tried:

i tried onnotify

NMHDR* pnmh = (NMHDR*)lParam;

if ( TCN_SELCHANGE == pnmh->code )
Posted
Updated 7-May-18 2:46am

1 solution

Add a notification handler for the TCN_SELCHANGING notification code (Windows)[^] and get the actual (soon previous) index with TabCtrl_GetCurSel macro (Windows)[^]. Optionally store that in a member variable.
 
Share this answer
 
Comments
Member 13798855 9-May-18 10:19am    
but we will get only current index i want previous index
Jochen Arndt 9-May-18 11:55am    
That notification is send before the change takes effect so that the actual index at that time is the previous one when the TCN_SELCHANGE notification is handled. If you store the index in a member variable within that handler, you can access it after the change has occured and have the previous index.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900