Thursday, August 28, 2008  



 FarPoint Technologies
 (800) 645-5913

 fpsales@fpoint.com



     
 »Tab Pro »Product Tour » Child Controls

Previous Working with Child Controls Next

You can display the tab using any of three modes: tab mode, one-page book mode, and two-page book mode. The following picture illustrates the different elements of the two-book mode. All visual elements can be customized.

Add child controls to a tab | Add child controls to every tab | Enumerate child controls' names and tags | Obtain coordinates of client area | Center child control in client area | Resize child controls automatically | Optimizing response time

  Back to Top
 Add child controls to a tab
You can add child controls to a Tab control by first selecting the tab and drawing the controls directly on the Tab control's client area at design time. When switching between tabs, the tab control automatically remembers every control that was placed on the individual tabs.

If you are adding several controls to a tab, you can increase the Tab control's response time by placing the child controls within the Imprint control on the tab, discussed later in the tour.

To place child controls on your Tab ActiveX controls at design time, your container must support ISimpleFrameSite. If your container does not support ISimpleFrameSite, you must add child controls at run time. Tab Pro

  Back to Top
 Add child controls to every tab
Tab ProTo decrease used memory resources and to make it easy to maintain code, you can add single controls that will appear on every tab. For example, you could add an exit button to appear on every tab. This decreases the memory being used because it is only one control, instead of eight controls for example. Your code is also simplified by only having to respond to a single, instead of multiple, control events.

1. Set the Tab property to -1.

In tab mode and in one-page book mode, this specifies to add child controls to all tabs and all pages. In two-page book mode, this specifies to add child controls to all odd tabs and pages.

If your Tab control is in two-page book mode, set the Tab property to -2, and then create controls on one tab to be displayed on all even tabs and pages.
2. Create controls on one tab to be displayed on all tabs, or, in two-page book mode, all odd tabs and pages.


 Back to Top
 Enumerate child controls' names and tags
Tab ProIf your project uses an ActiveX Tab control and you have placed child controls on the Tab control, you can return the child controls' names or tags using the TabEnumChildNames and TabEnumChildTags methods.

The TabEnumChildTags method returns the tag value you have assigned to child controls by setting their Tag property. If you think you will want to enumerate child controls using the TabEnumChildTags method, be sure to assign tags to every child control in the Tab control.

Tab Pro

  Back to Top
 Obtain coordinates of client area
You can use the coordinates of the client area to perform such tasks as sizing child windows or centering the controls on a tab.

Which properties or functions you use to obtain the coordinates depends on which mode you are in and, in two-page book mode, which page you are on.
  ClientHeight Returns the height of the usable client area in the Tab control.
  ClientLeft Returns the left coordinate of the usable client area in the Tab control.
  ClientTop Returns the top coordinate of the usable client area in the Tab control.
  ClientWidth Returns the width of the usable client area in the Tab control.
  ClientHeightPrev Returns the client area height for the previous page with the Tab control in two-page book mode.
  ClientLeftPrev Returns the left coordinate of the client area for the previous page with the Tab control in two-page book mode.
  ClientTopPrev Returns the top coordinate of the client area for the previous page with the Tab control in two-page book mode.
  ClientWidthPrev Returns the client area width for the previous page with the Tab control in two-page book mode.

  Back to Top
 Center child control in client area
Tab ProObtaining the coordinates of a control, explained above, makes it easy to reposition or center child controls within the tab control.

You can ensure that the control will always be visible on the form by setting the AutoSizeand AutoSizeChildren properties to automatically resize and reposition the control.

  Back to Top
 Resize child controls automatically
Using the ActiveX control and the AutoSizeChildren property, you can set properties to change the size and position of child controls automatically in the same proportions as the Tab control when the Tab control's size changes. When the child controls' are resized in response to the Tab control sizing, the ChildrenSized event occurs.

  0 - None (Default) Does not resize child controls.
  1 - Position Only Changes position of controls in proportion to parent (Retains original size.)
  2 - Size Only Resizes controls in same proportions as parent (Retains original position.)
  3 - Both Changes both size and position of controls in same proportions as parent.

  Back to Top
 Optimizing response time
Tab ProYou can increase the Tab control's responsiveness by combining child controls within another control on the tab, for example, by putting them in the Imprint control. With all the controls grouped, the Tab control monitors the group as a single control (rather than as individual controls), thus increasing responsiveness.

This optimization works under any development environment that supports ISimpleFrameSite (Visual Basic is an example of a development environment that supports ISimpleFrameSite.) DLL users cannot use this optimization.


Previous Working with Child Controls Next

    
 Have a question?
Have a Question? Ask Us!
Subscribe to the RSS feed!RSS Subscribe
 

 
Learn about the new Roadshow now!

Tab Pro Tour
Tab Pro Overview
Using the Tab Control
Working with Tabs
Working with Pages
Working with Book Mode
Working with Child Controls
Using the Imprint Control
Rate this Tour

Copyright © 1991-2007 FarPoint Technologies, Inc. All rights reserved. All names are property of their respective owners.