Create a new tab at runtime with an associated window form

forum.sourcecode (2000-2005) & forum.td.sourcecode (2005-2010)
Mick

Create a new tab at runtime with an associated window form

Post by Mick » 02 Aug 2007, 07:41

 Posted by:  Mick 

Hi

How do i create a new tab at runtime that contains an associated window
form? I'm using the QuickTabs gupta samples and i'm using the code in the
dlgAdd window to dynamically add a tab, but i'm stuck on how to load a child
window form into the tab and associate it with the newly created tab.

Help please!

Many thanks
Michael

Krzysztof Dorko

Re: Create a new tab at runtime with an associated window form

Post by Krzysztof Dorko » 02 Aug 2007, 14:38

 Posted by:  Krzysztof Dorko 

Hi
this should help
!!CB!! 70
Set pProp = CStructAllocFarMem ( SalStrLength ( " dlgChild" ) + 1 )
If pProp
Call CStructPutString2 ( pProp, 0, SalStrLength ( " dlgChild" ) + 1, "
dlgChild" )
Call SetPropA ( hTab, "TabFormPages", pProp )
Call CStructFreeFarMem ( pProp )
Call hTab.cQuickTabs.AddPage( 'PageName', 'dlgChild', dlgChild )
Call hTab.cQuickTabs.CreatePage( 'PageName' )
Call hTab.cQuickTabs.InitializeFormPages( "" )
Call hTab.cQuickTabs.Redraw( )

Kris

Jim McNamara

Re: Create a new tab at runtime with an associated window form

Post by Jim McNamara » 02 Aug 2007, 16:50

 Posted by:  Jim McNamara 

I sub-classed cQuickTabsForm...


Function: c_fDefine
Description:
Returns
Number:
Parameters
String: p_sTabLabel
String: p_sFormToAttach
Boolean: p_bAddTab
Static Variables
Local variables
Number: nReturn
String: sTabName
Actions
If p_bAddTab
Set nReturn = picTabs.Add( FALSE )
Else
Set nReturn = 0
Set sTabName = 'Tab' || SalNumberToStrX( nReturn, 0 )
Call picTabs.SetName( nReturn, sTabName )
Call picTabs.SetLabel( nReturn, p_sTabLabel, TRUE )
If picTabs.AddPage( sTabName, p_sFormToAttach, hWndNULL)
Call picTabs.Redraw( )
! Call picTabs.SetCurrentPage( sTabName )
Return nReturn
Function: c_fSetLabel
Description:
Returns
Parameters
Number: p_nTab
String: p_sLabel
Static Variables
Local variables
Actions
Call picTabs.SetLabel( p_nTab, p_sLabel, TRUE )
Message Actions
On PAM_LabelTab
Set sTabLabel[picTabs.GetTop( )] = SalNumberToHString( lParam )
Call c_fSetLabel( picTabs.GetTop( ), sTabLabel[picTabs.GetTop( )] )
Call picTabs.Redraw( )
On PAM_PasshWnd
Set nCurrentTab = picTabs.GetTop( )
Set hWndTabs[nCurrentTab] = SalNumberToWindowHandle( wParam )
On SAM_Create
Set hWndMyParent = SalParentWindow( hWndForm )

Mick

Re: Create a new tab at runtime with an associated window form

Post by Mick » 03 Aug 2007, 04:30

 Posted by:  Mick 

Thanks for the help.
Sorry, but i can't get it working. Could you send me a sample on how you
have it working?

Thanks Again

Michael

Krzysztof Dorko

Re: Create a new tab at runtime with an associated window form

Post by Krzysztof Dorko » 03 Aug 2007, 06:32

 Posted by:  Krzysztof Dorko 

Hi
this is a sample
hth
Kris

You do not have the required permissions to view the files attached to this post.

Return to “td.sourcecode”

Who is online

Users browsing this forum: [Ccbot] and 0 guests