Hi,
I thought this was simple until I tried to do it can any one help...
I have 3 tabs, 1 of them i would like to hide. and then somewhere along in my software i will show it.
is this possible ? do i have to create the tab myself in code ? how do i go about adding the form i want after?
hope you guys can help
thanks Paul.
It is possible. Below is code that should help you.
Type TABPAGEINFO_TYPE
zText As Asciiz * %MAX_PATH
iImage As Long
lParam As Long
End Type
Global gTabPageInfo As TABPAGEINFO_TYPE
When you want to remove a Tab, simply save the information related to the Tab into the global type and then remove it from the Tab Control. The code below removes Tab #1 (i.e. the second tab in a tab control because the tabs are zero based).
' Save the ITEM of the Tab Control to the global variable
Local tcitem As TC_ITEM
tcitem.mask = %TCIF_TEXT Or %TCIF_IMAGE Or %TCIF_PARAM
TabCtrl_GetItem HWND_FRMMAINFORM_TABCONTROL1, 1, tcitem
' Save the tab pages data to the global type
gTabPageInfo.zText = FF_TabControl_GetText( HWND_FRMMAINFORM_TABCONTROL1, 1 )
gTabPageInfo.lParam = tcitem.lParam
gTabPageInfo.iImage = gTabPageInfo.iImage
' Remove the actual tab page
TabCtrl_DeleteItem HWND_FRMMAINFORM_TABCONTROL1, 1
When you want to redisplay Tab #1 then do the following:
' Restore the ITEM of the Tab Control
Local tcitem As TC_ITEM
tcitem.mask = %TCIF_TEXT Or %TCIF_IMAGE Or %TCIF_PARAM
tcitem.pszText = VarPtr(gTabPageInfo.zText)
tcitem.cchTextMax = SizeOf(gTabPageInfo.zText)
tcitem.lParam = gTabPageInfo.lParam
tcitem.iImage = gTabPageInfo.iImage
TabCtrl_InsertItem HWND_FRMMAINFORM_TABCONTROL1, 1, tcitem
Brilliant,
Il give it a wirl.
thanks again.
Paul
fantasic works a treat.
wish i could have decoded the winapi stuff on my own though
thanks for the support :p
Paul
1 slight problem is the icons (added via firefly) on the tabs only re appear as the first icon.
not the icon assigned at the start.
I made a little error in writing the code that saves the parameters prior to removing the tab.
gTabPageInfo.iImage = gTabPageInfo.iImage
The above line should be:
gTabPageInfo.iImage = tcitem.iImage
YOU ARE A STAR!!!
THANK YOU