ComponentOne SizerOne 8.0

ElasticOne Reference

TabOne Reference

AwkOne Reference


Overview

Welcome to Componentone SizerOne™ 8.0 for ActiveX, the newest version of VS-OCX™. SizerOne 8.0 is a four-in-one component tool that includes two resizing controls to easily handle both simple and complex sizing; a tabbing control to quickly create notebook-style and Outlook-style tabs; and a parsing control to automatically slice and dice strings. If you like SizerOne 8.0 for ActiveX, you can check out our other products by visiting our web site at http://www.componentone.com/ .

ComponentOne has a user-friendly distribution policy. We want every programmer to obtain a copy of SizerOne 8.0 for ActiveX to try for as long as they wish. Those who like SizerOne 8.0 and find it useful may buy a license for a reasonable price. The only restriction is that unlicensed copies of SizerOne 8.0 for ActiveX will display a ComponentOne banner every time they are loaded to remind developers to license the product.

We are confident that you will like SizerOne 8.0 for ActiveX. If you have any suggestions or ideas for new features or tools that you'd like to see included in a future version please call us or write:

Corporate Headquarters

ComponentOne LLC
4516 Henry Street
Suite 500
Pittsburgh, PA 15213 USA
412.681.4343
412.681.4384 (Fax)


Product Profile

The ComponentOne SizerOne 8.0 package consists of three custom controls:

The ElasticOne Control

The ElasticOne control is extremely flexible. By itself, it allows you to display text, pictures, and a progress indicator bar, working as a powerful replacement for several basic controls that ship with Visual Basic.

The real power of the Elastic control shows when you use it as a container for other controls. It exposes a rich set of properties that allow you to automatically align, resize, label and frame the child controls, making it very easy to design and implement resolution-independent, resizable forms with no code behind them.

For more information, see The ElasticOne Control.

The TabOne Control

With the TabOne control, it only takes a few minutes (and no code whatsoever) to create fully functional tab-based interfaces.

For more information, see The TabOne Control.

The AwkOne Control

The AwkOne control allows you to quickly scan and parse text files. It is the ideal tool for doing simple data manipulation -- changing its format, checking its validity, retrieving items, generating reports, and the like -- without having to write a lot of code to scan and parse files.

For more information, see The AwkOne Control.


Installation

To install the ComponentOne SizerOne 8.0 library, use the SETUP.EXE utility provided on the installation CD or diskettes. When you are prompted, enter the registration key (found on the CD case or the diskette) exactly as it is printed and click REGISTER to complete the registration. You may register any other ComponentOne products for which you have purchased a registration key at this time as well.

The following files will be installed into your Windows\System directory or, if you use Windows NT, into your WinNT\System and WinNT\System32 directories. To use SizerOne in your Visual Basic projects, you must include these files in the project:

c1sizer.ocx: Contains the ElasticOne and TabOne ActiveX controls.

c1akw.ocx: Contains the AwkOne ActiveX control.

c1sizerppg.dll

The following folders will be created by the setup utility:

ComponentOne: Directory used to store ComponentOne control information.

ComponentOne\SizerOne: Contains sample projects and a README.TXT file with information about the SizerOne library.


Upgrading from VSOCX6

The SizerOne ActiveX control library is 100% code-compatible with VSOCX6. If you have Visual Basic projects that use VSOCX6, you can convert them automatically using the Convert utility provided in source format as a Visual Basic sample.


Installing Demonstration Versions

If you wish to try SizerOne or any other ComponentOne products and do not have a registration key, use the SETUP.EXE utility provided on the distribution CD. When prompted, leave the registration key box blank, and press FINISH. The only difference between unregistered (demonstration) and registered (purchased) versions of our products is that registered versions will stamp every application you compile so a banner will not appear when your users run the applications.


Uninstalling SizerOne

To uninstall SizerOne, use the UNSETUP.EXE utility provided on the installation CD or diskettes.


Adding the SizerOne Components to the Toolbox

ElasticOne, TabOne, and AwkOne are the components used to handle both simple and complex sizing; create notebook-style and Outlook-style tabs; and automatically slice and dice strings to any Visual Basic project.

To use the SizerOne components, they must be added to the Visual Studio Toolbox:

Open the Visual Basic IDE (Microsoft's Integrated Development Environment). Make sure the Toolbox is visible (if necessary, select Toolbox in the View menu).

To set up the SizerOne components to appear on their own tab, right-click anywhere in the Toolbox and select Add Tab from the context menu. Enter a tab name, for example, “SizerOne”, in the dialog box. Select the new tab. Right-click the gray area under that tab and select Components from the context menu. The Components dialog box opens.

In the Components dialog box, find and select ComponentOne Sizer/Tab Controls 8.0. Click OK.


End-User License Agreement

IMPORTANT-READ CAREFULLY: This End User License Agreement (this "EULA") contains the terms and conditions regarding your use of the SOFTWARE (as defined below). This EULA contains material limitations to your rights in that regard. You should read this EULA carefully and treat it as valuable property.

I. THIS EULA.

1.

Software Covered by this EULA. This EULA governs your use of the ComponentOne, LLC ("C1") software product(s) enclosed or otherwise accompanied herewith (individually and collectively, the "SOFTWARE"). The term "SOFTWARE" includes, to the extent provided by C1: 1) any revisions, updates and/or upgrades thereto; 2) any data, image or executable files, databases, data engines, computer software, or similar items customarily used or distributed with computer software products; 3) anything in any form whatsoever intended to be used with or in conjunction with the SOFTWARE; and 4) any associated media, documentation (including physical, electronic and on-line) and printed materials (the "Documentation").

2.

This EULA is a Legally Binding Agreement Between You and C1. If you are acting as an agent of a company or another legal person, such as an officer or other employee acting for your employer, then "you" and "your" mean your principal, the entity or other legal person for whom you are acting. However, importantly, even if you are acting as an agent for another, you may still be personally liable for violation of federal and State laws, such as copyright infringement.

This EULA is a legally binding agreement between you and C1. You intend to be legally bound to this EULA to the same extent as if C1 and you physically signed this EULA. By installing, copying, or otherwise using the SOFTWARE, you agree to be bound by the terms and conditions contained in this EULA. If you do not agree to all of the terms and conditions contained in this EULA, you may not install or use the SOFTWARE. If, for whatever reason, installation has begun or has been completed, you should cancel installation or un-install the SOFTWARE, as the case may be. (You may click on the "exit" button or its equivalent to immediately abort installation.) If you do not agree to all of these terms and conditions, then you must promptly return the SOFTWARE to the place of business from which you obtained it in accordance with any return policies of such place of business. Return policies may vary between or among resellers, and you must comply with your particular reseller's return policies as agreed at the point of purchase. If the place of business from which you purchased the SOFTWARE does not honor a complete refund for a period of thirty (30) days from the date of proof of purchase, then you may return the SOFTWARE directly to C1 for a period of thirty (30) days from the date of your purchase. To return the product directly to C1, you must obtain a C1 Return Authorization Number by contacting C1, and you must forward all items purchased, including the proof of purchase, directly to C1. The return must be postage-prepaid, and post-marked within thirty (30) days from the proof of purchase, time being of the essence. The return option to C1 is only available to the original purchaser of an unopened factory packaged item.

II. YOUR LICENSE TO DEVELOP AND TO DISTRIBUTE.

As provided in more detail below, this EULA grants you two licenses: 1) a license to use the SOFTWARE to develop other software products (the "Development License"); and 2) a license to use and/or distribute the Developed Software (the "Distribution License"). Both of these licenses (individually and collectively, the "Licenses") are explained and defined in more detail below.

1.

Definitions. The following terms have the respective meanings as used in this EULA:

"Network Server" means a computer with one or more computer central processing units (CPU's) that operates for the purpose of serving other computers logically or physically connected to it, including, but not limited to, other computers connected to it on an internal network, intranet or the Internet. "Web Server" means a type of Network Server that serves other computers more particularly connected to it over an intranet or the Internet.

"Developed Software" means those computer software products that are developed by or through the use of the SOFTWARE. "Developed Web Server Software" means those Developed Software products that reside logically or physically on at least one Web Server and are operated (meaning the computer software instruction set is carried out) by the Web Server's central processing unit(s) (CPU). "Developed Legacy Software" means those Developed Software products that are not Developed Web Server Software, including, for example, stand-alone applications and applications accessed by a file server only. "Redistributable Files" means the SOFTWARE files or other portions of the SOFTWARE that are provided by C1 and are identified as such in the Documentation for distribution by you with the Developed Software. "Developer" means a human being or any other automated device using the SOFTWARE in accordance with the terms and conditions of this EULA.

"Developer Seat License" means that each Developer using or otherwise accessing the programmatic interface or the SOFTWARE must obtain the right to do so by purchasing a separate End User License. "Network Server CPU License" means that a separate End User License must be purchased for each CPU operating the computer software at issue in the reference.

“Source Code” shall mean computer software code or programs in human readable format, such as a printed listing of such a program written in a high-level computer language. The term "Source Code" includes, but is not limited to, documents and materials in support of the development effort of the SOFTWARE, such as flow charts, pseudo code and program notes.

2.

Your Development License. You are hereby granted a limited, royalty-free, non-exclusive right to use the SOFTWARE to design, develop, and test Developed Software, on the express condition that, and only for so long as, you fully comply with all terms and conditions of this EULA.

The SOFTWARE is licensed to you on a Developer Seat License basis.

The Developer Seat License means that you may perform a single install of the SOFTWARE for use in designing, testing and creating Developed Software by a single Developer on a single computer with a single set of input devices, so long as such computer is used only by one Developer. Conversely, you may not install or use the SOFTWARE on a computer that is a network server or a computer at which the SOFTWARE is used by more than one Developer. You may not network the SOFTWARE or any component part of it, where it is or may be used by more than one Developer unless you purchase an additional Development License for each Developer. You must purchase another separate license to the SOFTWARE in order to add additional developer seats, whether the additional developers are accessing the SOFTWARE in a stand-alone environment or on a computer network. If the SOFTWARE is used to create Developed Web Server Software, then you may perform a single install of the SOFTWARE for use in designing, testing and creating Developed Web Server Software by a single Developer on a single computer or Network Server, either with a single CPU only. An additional Network Server CPU License is required for each additional CPU on the single computer or Network Server, as the case may be, upon which the SOFTWARE and/or the Developed Web Server Software is installed and a separate license for each separate computer. That is, for Developed Web Server Software, if the computer or Network Server operating the SOFTWARE has 2 CPU's, then you would need to purchase one additional Network Server CPU License (beyond the one Developer Seat License granted in this EULA).

In all cases, you may not use C1's name, logo, or trademarks to market your Developed Software without the express written consent of C1; (b) you must include the following C1 copyright notice in your Developed Software documentation and/or in the "About Box" of your Developed Software, and wherever the copyright/rights notice is located in the Developed Software (“Portions Copyright © ComponentOne, LLC 1991-2002. All Rights Reserved.”); (c) agree to indemnify, hold harmless, and defend C1, its suppliers and resellers, from and against any claims or lawsuits, including attorney's fees that may arise from the use or distribution of your Developed Software; (d) you may use the SOFTWARE only to create Developed Software that is significantly different than the SOFTWARE.

3.

Your Distribution License.

a. License to Distribute Developed Legacy Software. Subject to the terms and conditions in this EULA, you are granted the license to use and to distribute Developed Legacy Software on a royalty-free basis, provided that the Developed Legacy Software incorporates the SOFTWARE as an integral part of the Developed Software in machine-language compiled format (customarily an ".exe", or ".dll", etc.). You may not distribute, bundle, wrap or subclass the SOFTWARE as Developed Software which, when used in a "designtime" development environment, exposes the programmatic interface of the SOFTWARE. You may distribute, on a royalty-free basis, Redistributable Files with Developed Legacy Software only.

b. License to Distribute Developed Web Server Software. Subject to the terms and conditions in this EULA, you are granted the license to use and to distribute Developed Web Server Software, provided that you must purchase one Network CPU License for each CPU operating the Developed Web Server Software (and/or Redistributable Files called or otherwise used directly by the Developed Web Server Software). You may purchase an additional Network CPU License by purchasing an additional separate End User License for the SOFTWARE; one Network CPU License is included in this EULA. Notwithstanding the foregoing, however, you may distribute or transfer, free of royalties, the Redistributable Files (and/or any Developed Legacy Software) to the extent that they are used separately on a single CPU on the client/workstation side of the network served by the Web Server.

4.

Specific Product Limitations. Notwithstanding anything in this EULA to the contrary, if the license you have purchased is for any of the following products, then the following additional limitations will apply:

a. C1 ReportDesigner. C1ReportDesigner includes at least: 1) one dynamic link library (c1.win.c1reportdesigner.dll) file known as C1ReportDesigner Component, 2) one executable (ReportDesigner.exe) file known as C1ReportDesigner Application and, 3) the Source Code of the C1ReportDesigner Application. The C1ReportDesigner Component is subject to the general terms and restrictions set forth in this EULA. The C1ReportDesigner Application is an executable file used to design and prepare reports; the C1ReportDesigner Application may be distributed, free of royalties, only in conjunction with the Developed Software.

Subject to the terms and conditions in this EULA, C1 hereby grants you the right to use the C1ReportDesigner Application Source Code. You are hereby also granted the right to modify such Source Code and to create derivative works that are based on the licensed Source Code. You may distribute the derivative works that you develop, solely in object code format and exclusively in conjunction with and/or as a part of the Developed Software. You are expressly not granted the right to distribute, disclose or otherwise make available to any third party the licensed Source Code, any modified version, derivative work, or any portion thereof, in source code format.

C1 shall retain all right, title and interest in and to the licensed Source Code, and all C1 updates, modifications or enhancements thereof. Nothing herein shall be deemed to transfer any ownership or title rights in and to the licensed Source Code from C1 to you.

SOURCE CODE IS LICENSED TO YOU AS IS. C1 DOES NOT AND SHALL NOT PROVIDE YOU WITH ANY TECHNICAL SUPPORT FOR YOUR SOURCE CODE LICENSE.

b. VS View Reporting Edition. VS View Reporting Edition includes at least one executable file listed as “VSRpt7.exe”, known as “Designer.” The file "VSRpt7.exe”, or any upgrade or future versions of the Designer, are subject to the restrictions set forth in this EULA and may not be distributed with your Developed Software or in any other way.

c. VSForum. VSForum is intended to be installed on a Network Server. C1 grants to you the following rights to the SOFTWARE: a) Installation: You may install one copy of the SOFTWARE on a single Network Server; b) Use: When installed and initialized, the SOFTWARE creates a database file which contains the embodiment of a discussion forum (the database hereinafter referred to as the "Forum"). You may use the SOFTWARE to create one Forum on one Network Server only, which server may be connected at any point to an unlimited number of workstations or computers operating on one or more networks. You are specifically NOT LICENSED to create or operate multiple Forums. To create or to operate more than one FORUM, you must purchase one additional SOFTWARE license for each additional Forum.

d. Doc-to-Help. You may use Doc-To-Help to create online help, manuals or other documentation in electronic or printed format (the "Output Documents"). You may distribute and incorporate in such Output Documents those files identified in the documentation as Redistributable Files. Except for those specific Redistributable Files, you MAY NOT distribute the SOFTWARE, in any format, to others.

e. Studio Products. You may not share the component parts of the Studio Products licensed to you with other Developers, nor may you allow the use and/or installation of such components by other Developers.

5.

Updates/Upgrades; Studio Subscription. Subject to the terms and conditions of this EULA, the Licenses are perpetual. Updates and upgrades to the SOFTWARE may be provided by C1 from time-to-time, and, if so provided by C1, are provided upon the terms and conditions offered at that time by C1 in its sole discretion. C1 may provide updates and upgrades to the SOFTWARE for free or for any charge, at any time or never, and through its chosen manner of access and distribution, all in C1's sole and complete discretion.

C1 licenses certain of its separately-licensed products bundled together in a product suite, called the C1 "Studio" product line (the "Studio Products"). The exact separately-licensed products that are bundled into the Studio Products may change from time-to-time in C1's sole discretion. If the SOFTWARE is identified as a C1 "Studio" product, then the SOFTWARE is one of the Studio Products. The SOFTWARE and the Studio Products are revised from time-to-time (meaning, for example, revised with updates, upgrades and, in the case of Studio products, possibly changes to which specific products are included in the bundle). For you to be entitled to receive any such revisions to the SOFTWARE or the Studio Products, as the case may be, you must have a valid SOFTWARE license or a valid Studio subscription. The original purchaser of the SOFTWARE or of a Studio product receives a one-year subscription from the date of purchase of the SOFTWARE. After one year, the Studio subscription and/or the SOFTWARE license must be renewed to continue to be entitled to receive the SOFTWARE and/or the Studio Products revisions as the case may be.

6.

Serial Number. Within the packaging of the SOFTWARE, a unique serial number (the "Serial Number") is included, which allows for the registration of the SOFTWARE. The Serial Number is subject to the restrictions set forth in this EULA and may not be disclosed or distributed either with your Developed Software or in any other way. The disclosure or distribution of the Serial Number shall constitute a breach of this EULA, the effect of which shall be the automatic termination and revocation of all the rights granted herein.

7.

Evaluation Copy. If you are using an "evaluation copy" or similar version, specifically designated as such by C1 on its website or otherwise, then the Licenses are limited as follows: a) you are granted a license to use the SOFTWARE for a period of thirty (30) days counted from the day of installation (the "Evaluation Period"); b) upon completion of the Evaluation Period, you shall either i) delete the SOFTWARE from the computer containing the installation, or you may ii) contact C1 or one of its authorized dealers to purchase a license of the SOFTWARE, which is subject to the terms and limitations contained herein; and c) any Developed Software may not be distributed or used for any commercial purpose.

III. INTELLECTUAL PROPERTY.

1.

Copyright. You agree that all right, title, and interest in and to the SOFTWARE (including, but not limited to, any images, photographs, animations, video, audio, music, text, and “applets” incorporated into the SOFTWARE), and any copies of the SOFTWARE, and any copyrights and other intellectual properties therein or related thereto are owned exclusively by C1, except to the limited extent that C1 may be the rightful license holder of certain third-party technologies incorporated into the SOFTWARE. The SOFTWARE is protected by copyright laws and international treaty provisions. The SOFTWARE is licensed to you, not sold to you. C1 reserves all rights not otherwise expressly and specifically granted to you in this EULA.

2.

Backups. You may either: (a) copy the SOFTWARE solely for backup or archival purposes; or (b) install the SOFTWARE on a single computer, provided you keep the original solely for backup or archival purposes. Notwithstanding the foregoing, you may not copy the Documentation.

3.

General Limitations. You may not reverse engineer, decompile, or disassemble the SOFTWARE, except and only to the extent that applicable law expressly permits such activity notwithstanding this limitation.

4.

Software Transfers. You may not rent or lease the SOFTWARE. You may transfer the SOFTWARE to another computer, provided that it is completely removed from the computer from which it was transferred. You may permanently transfer all of your rights under the EULA, provided that you retain no copies, that you transfer all the SOFTWARE (including all component parts, the media and printed materials, any dates, upgrades, this EULA and, if applicable, the Certificate of Authenticity), and that the recipient agrees to the terms and conditions of this EULA as provided herein. If the SOFTWARE is an update or upgrade, any transfer must include all prior versions of the SOFTWARE.

5.

Termination. Without prejudice to any other rights it may have, C1 may terminate this EULA and the Licenses if you fail to comply with the terms and conditions contained herein. In such an event, you must destroy all copies of the SOFTWARE and all of its component parts.

6.

Export Restrictions. You acknowledge that the SOFTWARE is of U.S. origin. You acknowledge that the license and distribution of the SOFTWARE is subject to the export control laws and regulations of the United States of America, and any amendments thereof, which restrict exports and re-exports of software, technical data, and direct products of technical data, including services and Developed Software. You agree that you will not export or re-export the SOFTWARE or any Developed Software, or any information, documentation and/or printed materials related thereto, directly or indirectly, without first obtaining permission to do so as required from the United States of America Department of Commerce's Bureau of Export Administration ("BXA"), or other appropriate governmental agencies, to any countries, end-users, or for any end-uses that are restricted by U.S. export laws and regulations, and any amendments thereof, which include, but are not limited to, the following:

Restricted Countries: Restricted Countries currently include, but are not necessarily limited to Cuba, Iran, Iraq, Libya, Montenegro, North Korea, Serbia, Sudan, and Syria.

Restricted End-Users: Any End-User whom you know or have reason to know will use SOFTWARE or Developed Software in the design, development, or production of missiles and missile technology, nuclear weapons and weapons technology, or chemical and biological weapons. Any national of any of the Restricted Countries, wherever located, who intends to transmit or transport the SOFTWARE or Developed Software to one of the Restricted Countries.

Restricted End-Uses: Any use of SOFTWARE and Developed Software related to the design, development, or production of missiles and missile technology, nuclear weapons and weapons technology, or chemical and biological weapons.

These restrictions change from time to time. You represent and warrant that neither the BXA nor any other United States federal agency has suspended, revoked or denied your export privileges. C1 acknowledges that it shall use reasonable efforts to supply you with all reasonably necessary information regarding the SOFTWARE and its business to enable you to fully comply with the provisions of this Section. If you have any questions regarding your obligations under United States of America export regulations, you should contact the Bureau of Export Administration, United States Department of Commerce, Exporter Counseling Division, Washington DC. U.S.A. (202) 482-4811, http://www.bxa.doc.gov.

7.

U.S. Government Restricted Rights. The SOFTWARE and documentation are provided with RESTRICTED RIGHTS. For solicitations issued before December 1, 1995, by the United States of America, its agencies and/or instrumentalities (the "Government"), other than the Department of Defense, the use, duplication or disclosure of the software and documentation provided to the Government under this EULA shall be subject to the RESTRICTED RIGHTS as set forth in subparagraphs (c)(1) and (2) of the Commercial Computer Software - Restricted Rights clause at 48 CFR ch.1 52.227-19. For solicitations issued before September 29, 1995, by the Department of Defense, the use, duplication or disclosure of the software and documentation provided under this EULA shall be subject to the RESTRICTED RIGHTS as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at 48 CFR ch.2 252.227-7013. You will comply with any requirements of the Government to obtain such RESTRICTED RIGHTS protection, including without limitation, the placement of any restrictive legends on the SOFTWARE, and any license agreement used in connection with the distribution of the SOFTWARE. Manufacturer is ComponentOne, LLC, 4516 Henry Street, Suite 501, Pittsburgh, Pennsylvania 15213 USA. For solicitations issued by the Government on or after December 1, 1995 and the Department of Defense on or after September 29, 1995, the only rights provided in the software and documentation provided herein shall be those contained in this EULA. Under no circumstances shall C1 be obligated to comply with any Governmental requirements regarding the submission of or the request for exemption from submission of cost or pricing data or cost accounting requirements. For any distribution of the SOFTWARE that would require compliance by C1 with the Government's requirements relating to cost or pricing data or cost accounting requirements, you must obtain an appropriate waiver or exemption from such requirements for the benefit of C1 from the appropriate Government authority before the distribution and/or license of the SOFTWARE to the Government.

IV. WARRANTIES AND REMEDIES.

1.

Limited Warranty. C1 warrants that the original media, if any, are free from defects for ninety (90) days from the date of delivery of the SOFTWARE. EXCEPT AS OTHERWISE PROVIDED IN THE PRECEDING SENTENCE, AND TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, C1 EXPRESSLY DISCLAIMS ANY WARRANTY FOR THE SOFTWARE, DOCUMENTATION AND ANYTHING ELSE PROVIDED BY C1 HEREBY AND C1 PROVIDES THE SAME IN “AS IS” CONDITION WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE AND DOCUMENTATION REMAINS WITH YOU. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL RIGHTS. YOU MAY HAVE OTHERS WHICH VARY FROM STATE TO STATE.

2.

Limited Remedy. C1's entire liability and your exclusive remedy under this EULA shall be, at C1's sole option, either (a) return of the price paid for the SOFTWARE; (b) repair the SOFTWARE through updates distributed online or otherwise in C1's discretion; or (c) replace the SOFTWARE with its reasonable, provided that you return the SOFTWARE in the same manner as provided in Section I.2 for return of the SOFTWARE for non-acceptance of this EULA. Any media for any repaired or replacement SOFTWARE will be warranted for the remainder of the original warranty period or thirty (30) days, whichever is longer. THESE REMEDIES ARE NOT AVAILABLE OUTSIDE OF THE UNITED STATES OF AMERICA. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL C1 BE LIABLE FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFIT, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE, EVEN IF C1 HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. BECAUSE SOME STATES/JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES IN CERTAIN CASES, THE ABOVE LIMITATION MAY NOT APPLY TO YOU.

V. MISCELLANEOUS.

1.

This is the Entire Agreement. This EULA (including any addendum or amendment to this EULA included with the SOFTWARE) is the final, complete and exclusive statement of the entire agreement between you and C1 relating to the SOFTWARE. This EULA supersedes any prior and contemporaneous proposals, purchase orders, advertisements, and all other communications in relation to the subject matter of this EULA, whether oral or written. No terms or conditions, other than those contained in this EULA, and no other understanding or agreement which in any way modifies these terms and conditions, shall be binding upon the parties unless entered into in writing executed between the parties, or by other non-oral manner of agreement whereby the parties objectively and definitively act in a manner to be bound (such as by continuing with an installation of the SOFTWARE, "clicking-through" a questionnaire, etc.) Employees, agents and other representatives of C1 are not permitted to orally modify this EULA.

2.

You Indemnify C1. You agree to indemnify, hold harmless, and defend C1 and its suppliers and resellers from and against any and all claims or lawsuits, including attorney's fees, that arise or result from this EULA.

3.

Interpretation of this EULA. If for any reason a court of competent jurisdiction finds any provision of this EULA, or any portion thereof, to be unenforceable, that provision of this EULA will be enforced to the maximum extent permissible so as to effect the intent of the parties, and the remainder of this EULA will continue in full force and effect. Formatives of defined terms shall have the same meaning of the defined term. Failure by either party to enforce any provision of this EULA will not be deemed a waiver of future enforcement of that or any other provision. Except as otherwise required or superseded by law, this EULA is governed by the laws of the Commonwealth of Pennsylvania, without regard to its conflict of laws principles. The parties consent to the personal jurisdiction and venue of the Commonwealth of Pennsylvania, in the County of Allegheny, and agree that any legal proceedings arising out of this EULA shall be conducted solely in such Commonwealth. If the SOFTWARE was acquired outside the United States, then local law may apply.


Redistributable Files

You may distribute the SizerOne controls including C1sizer.ocx, C1akw.ocx, and C1sizerppg.dll free of royalties when you ship your application. You may include copies of the OCX files with as many copies of your application as you ship.

Groups of multiple developers may be interested in acquiring ComponentOne product site licenses. Please contact ComponentOne for details.

If you have not yet registered your copy of SizerOne and would like to do it now, just fill out the Order Form included in this documentation.


Technical Support

ComponentOne SizerOne 8.0 for ActiveX is developed and supported by ComponentOne LLC, a company formed by the merger of APEX Software Corporation and VideoSoft. You can obtain technical support using any of the following methods:


ComponentOne Web site

The ComponentOne Web site at http://www.componentone.com/ provides a wealth of information and software downloads for SizerOne 8.0 for ActiveX users, including:

•

Descriptions of the various support options available through the ComponentOne Service Team.

•

Answers to frequently asked questions (FAQ's) about our products, organized by functionality. Please consult the FAQ's before contacting us directly, as this can save you time and also introduce you to other useful information pertaining to our products.

•

Free product updates, which provide you with bug fixes and new features.


Internet e-mail

For technical support through the Internet, e-mail us at:

support.sizerone@componentone.com

To provide you with the best support, please include the following information when contacting ComponentOne:

•

Your ComponentOne product serial number.

•

The version and name of your operating system.

•

Your development environment and its version.

For more information on technical support, go to http://www.componentone.com/support.


Peer-to-Peer newsgroup

ComponentOne also sponsors a peer-to-peer newsgroup for ComponentOne SizerOne users. ComponentOne does not offer formal technical support in this newsgroup, but instead sponsors it as a forum for users to post and answer each other's questions regarding ComponentOne SizerOne. However, ComponentOne may monitor the newsgroup to ensure accuracy of information and provide comments when necessary. You can access the newsgroup from the ComponentOne Web site at: www.componentone.com/newsgroups.


The ElasticOne Control

Before you can use an ElasticOne control in your application, you must add the SIZERONE.OCX file to your project. If you use the control in most of your VB projects, you may want to add it to VB's Autoload file.

To distribute applications you create with the ElasticOne control, you must install and register it on the user's computer. The Setup Wizard provided with Visual Basic provides tools to help you do that. Please refer to the Visual Basic manual for details.

The ElasticOne control is a versatile smart container. It can save you hundreds of lines of Visual Basic code by allowing you to:

•

Automatically align the control to the left, right, top, bottom, or to fill its container, whether it is a form or another control;

•

Automatically resize the Elastic's child controls, evenly or unevenly, vertically, horizontally, proportionally, or using a positioning grid;

•

Allow the user to resize controls with the mouse (Splitter bars) inside the Elastic at runtime;

•

Label child controls based on their Tag property, instead of using several label controls;

•

Draw frames around child controls;

•

Create multi-line labels, progress bars, or both in a single Elastic control.

You can use the Elastic control as an enhanced replacement for the following Visual Basic controls: Image controls, Labels, Frames, and Progress Indicators. To find out how, look up the following properties in the reference section of this manual:

To replace:

Look up these properties:

Label Controls

TagWidth, TagPosition, TagSplit, CaptionPos

Image Controls

Picture, PicturePos

Frame Controls

Style

Progress Bars

FloodStyle, FloodColor, FloodDirection, FloodPercent

To learn more about the Elastic's main features, aligning and resizing controls, see the following properties: Align and AutoSizeChildren.

The following sections of the documentation describe how to use the Elastic control by itself and as a container for other controls.

Using the ElasticOne by itself

Using the ElasticOne as a Container

Using the Align Property

Using the AutoSizeChildren property

Using the Grid Mode

The Grid Editor


Using the ElasticOne by itself

The ElasticOne control can replace the Label, Image, and Progress Bar controls that ship with Visual Basic.

To replace Label controls, use the Caption property to set the text you want to display, then use the CaptionPos property to align the text. Finally, use the BorderWidth and WordWrap properties to determine how far from the edges of the control the text should be displayed and whether or not it should be allowed to wrap. Unlike the Label control, the Elastic allows you to center multi-line captions vertically and to display pictures along with the text.

To replace Image controls, use the Picture property to select the picture you want to display and the PicturePos property to scale and align the picture. Finally, use the BorderWidth property to determine how far from the edges of the control the picture should be displayed. Unlike the Image control, the Elastic allows you to tile, align and scale the picture, and also to display text along with the picture.

To replace Progress Bar controls, use the FloodStyle, FloodDirection, and FloodColor properties to select the appearance of the progress bar, and set the FloodPercent property to a value between 0 and 100 to indicate the progress. Unlike the Progress Bar control, the Elastic allows you to use solid, block, or picture bars to indicate the progress, and to fill the indicator in any direction.

The picture below shows an Elastic control being used to replace a Label and a Progress Bar controls.

And here is the code that created the Elastic control (the control name is el):

Private Sub Form_Load()

With el

.Frame = fcClient

.FrameStyle = ftGroove

.Picture = LoadPicture(App.Path & "\stone.gif")

.PicturePos = ppTile

.FloodStyle = fsPicture

.FloodDirection = fdRight

.FloodPercent = 75

.CaptionPos = cpCenterCenter

.Caption = el.FloodPercent & " %"

End With

End Sub


Using the ElasticOne as a Container

To use the Elastic as a container, simply drop other controls into it at design time. The Elastic will then provide several options to label, frame, and resize its child controls.

Tag Labels

Using the Elastic control to label its children allows you to eliminate several Label controls from your form, making it easier to create and faster to load. It also ensures that the labels will remain attached to their parent controls as you move them around the form. To label child controls, follow these steps:

1.

Set the Tag property of each child control to the text you would like to use as a label. The text may include ampersand characters ("&") to indicate accelerator keys, just like regular labels.

2.

Set the Elastic's TagWidth, TagPosition, and CaptionPos properties to determine the size and alignment of the labels.

That is all there is to it. You can fine-tune the labels using the TagSplit property to store additional information in the Tag property of the child controls and to control the alignment of individual labels.

Frames

Using the Elastic control to draw frames around its children is easy and allows you to enhance the appearance of your forms. To draw frames, use the Frame, FrameStyle, and FrameWidth properties to determine which children should have frames, the type and width of the frames. You can also control frame color using the FrameColor and FrameShadow properties.

Aligning and Resizing

To use the Elastic as a resizing container, use the two main properties offered by the control: Align and AutoSizeChildren.

The Align property determines how the Elastic should align itself to its parent control or form when it is resized. It is similar to the Align property provided by other controls such as the Picture Box control, but is more powerful because it provides an additional setting, 5 - asFill, which causes the control to fill its container, and also because it works when the Elastic is placed inside other controls, not only on forms.

The AutoSizeChildren property determines how the Elastic should align its child controls when it is resized. There are many settings available, ranging from simple (1 - szEvenHorz) to sophisticated (8 - azGrid).

These two properties are described in detail in the following topics.


Using the Align Property

The Elastic's Align property is similar to the Align property provided by other controls such as the Picture Box control, but it provides additional settings and capabilities.

Like the standard Align property, the Elastic's Align lets you align the control to the top, bottom, left, or right of a form. In addition, the Elastic's Align property lets you align controls to fill the entire form when it is resized.

The other difference is that the standard Align property lets you align to forms only, while the Elastic's Align property lets you align to any container control, including other Elastics.

There is only one thing to remember when using the Elastic Align property: if several Elastics within the same container have their Align property set, the ones further behind get aligned first, and reduce the area available for the other controls. The pictures below illustrate this:

Both forms shown above have three Elastics, one aligned to the top, one to the left, and one that fills the container. The difference is that on Form1, the Elastic aligned to the top was created first. It aligned itself to the top and reduced the free area on the form. The second Elastic aligned itself to the left of the remaining area.

On Form2, the Elastic aligned to the left was created first. It aligned itself to the left and reduced the free area on the form. The second Elastic aligned itself to the top of the remaining area.

This does not mean that you have to create the Elastics in perfect order to use the Align property. Visual Basic's Format menu has options that allow you to send controls to the back or bring them to the top, changing the order in which they are aligned.

For example, if you selected the Elastic aligned to the left on Form1, then clicked on the Format|Order|Send To Back (ctrl-K) Visual Basic menu option, it would become identical to Form2. You can even change the order of the controls at runtime, using the ZOrder method.


Using the AutoSizeChildren property

While the Align property governs resizing the Elastic within its container, the AutoSizeChildren property governs resizing of the controls inside the Elastic.

The AutoSizeChildren property has several settings, ranging from simple ones to very sophisticated. We will cover each setting one by one, starting with the simpler ones:

Proportional Sizing

Even Sizing

Uneven Sizing

Elastic-only Sizing

Grid Sizing


Proportional Sizing

AutoSizeChildren = 7 – azProportional

This is the easiest setting to explain. When the Elastic gets resized, all its children are resized proportionally. The picture below shows an example:

The form shown above has a single Elastic control with the Align property set to 5 - asFill and AutoSizeChildren set to 7 - azProportional. All other controls are placed on the Elastic. When the form is resized, all controls are also resized and retain their proportions.

Note that the fonts are not automatically resized unless you set the ResizeFonts property to True.

Like all other settings, 7 - azProportional works also at design time. This is normally a very useful feature, but it can get in the way if you want to open up more room on the form for other controls. To disable the auto resizing feature of the Elastic, set AutoSizeChildren to azNone, do all the editing you want, then set it back to azProportional. Alternatively, you may use the FreezeElastics property to temporarily suspend all Elastic resizing.


Even Sizing

AutoSizeChildren = 1 - azEvenHorz, 3 – azEvenVert

Use these settings when you want to distribute controls evenly within the Elastic. The picture below shows how these settings work when you resize a form.

The Elastic aligned to the top of the form has AutoSizeChildren set to azEvenHorz, and the vsElastic aligned to the left of the form has AutoSizeChildren set to azEvenVert. Notice how they resize the controls inside them as the form gets resized.

Changing the order of the children within the Elastic is easy, just drag controls to their new position with the mouse. The Elastic will automatically sort and align them for you. The resizing works at design time too.

If you want, you can also change the order of the children at runtime; all you have to do is move the control with code just like you would with the mouse. For example, to move button 4 to the left of button 3 on the form shown above, you would use; the following code:

Button4.Left = (Button3.Left - Button2.Left) \ 2

The above code would move button 4 to a position between buttons 2 and 3. The Elastic would then take care of realigning the controls to the proper position.


Uneven Sizing

AutoSizeChildren = 2 - azUnevenHorz, 4 - azUnevenVert

Sometimes you do not want all the children controls to be the same size or to remain proportional. A typical example is a status bar, where you may reserve a few fixed-size spots to show keyboard status and use the remaining space to show help messages and prompts.

The pictures below show a form with an Elastic-based status bar, before and after resizing:

The Elastic shown above has the Align property set to 2 - asBottom and the AutoSizeChildren property set to 2 - azUnevenHorz. It also has a number of child controls used to display status information. When the form is resized, only the leftmost child gets resized.

How does the Elastic decide which child to resize? It always picks the topmost control. All you have to do to create unevenly spaced Elastics is:

1.

Create all the children and size them appropriately;

2.

Decide which one you would like the Elastic to resize for you, and make it the foremost control using Visual Basic's Format|Order|Bring to Front menu option (or pressing ctrl-J);

3.

Set the AutoSizeChildren property to one of the uneven settings.

That is all there is to uneven spacing. When the Elastic is resized, the foremost child gets stretched to fill the gap left by the others.


Elastic-only Sizing

AutoSizeChildren = 5 - azElastHorz, 6 - azElastVert

These settings tell the Elastic to resize only child controls which are also Elastics. This is a combination of the settings described above. If all child controls are Elastics, these setting are equivalent to the Even settings. If only the top child control is an Elastic, these settings are equivalent to the Uneven settings.

You can use these settings to center clusters of controls on a form, as shown below.

The Elastic shown above has the Align property set to 2 - asBottom and the AutoSizeChildren property set to 5 -azElastHorz. It also has four children: two Elastics and two command buttons between the Elastics. When the form is resized, the Elastics are resized and push the command buttons to the center of the container.


Grid Sizing

AutoSizeChildren = 8 - azGrid

This is the most powerful setting available. It turns the Elastic into a piece of graph paper, where each child control occupies one or more of the little boxes on the paper. This is similar to tables in word processors such as Microsoft Word™, where you can merge adjacent cells, and to Java's Grid Bag Layout, which works in a similar way.

The azGrid setting is so powerful it deserves its own topic in this document, as well as several tutorials. For more details, keep reading.


Using the Grid Mode

Since its original release, the Elastic control has been the easiest, most powerful way to add dynamic layout capabilities to your Visual Basic forms without writing code. In the past, however, creating complex layouts required the use of nested Elastics, which made forms harder to design and slower to load.

The grid mode changes all that. You can now create layouts as complex as you like, with all resizing capabilities you want (including splitters and fixed areas), using a single Elastic control on the form. And, of course, you can still create these layouts without writing any code.

Think of the grid mode as a piece of graph paper. Each component will occupy one or more of the little boxes on the paper. This is similar to tables in word processors such as Microsoft Word™, where you can merge adjacent cells, and to Java's Grid Bag Layout, which works in a similar way.

This following sections will walk you through the creation of two forms, both based on the Elastic's new Grid mode.

Create the Grid, then add controls

Create the controls, then add the Grid

Grid Mode Reference

Design-time Mouse Commands

The Grid Context Menu

Automatically Setting the Layout


Create the Grid, then add controls

To see how the grid mode works, place an Elastic control on a form, then set the following properties:

Align = asFill ' 5

AutoSizeChildren = azGrid ' 8

ChildSpacing = 2

GridRows = 8

GridCols = 8

Your form will look like this:

The grid appears only at design time, to help you lay out the controls on the form. It is not visible at run time.

Now you can start placing controls on the form, approximately where you want them. They will snap to the nearest point on the grid. Place a few text boxes, for example, so the form will look like this:

Notice how the controls are automatically aligned, and how you can build fields that span multiple grid cells. If you resize the form now, the controls will resize automatically (as you probably expected).

Of course, the Tag Label feature of the Elastic still works, so if you set the Elastic's TagWidth property to 5000, CaptionPos to 6 - cpRightTop, and the Tag property on each control to a label, you will get a form that is practically ready to use:

Just for fun, set the Elastic's Font property to something like Tahoma 8, and set FontResize to True. Run the project and resize the form a few times. The font will be automatically resized, according to the form's new width and height.

If you would like to make the last column on the form a little narrower, hold down the shift and control keys, then click on the grid line and drag it to the right. The form will look like this:

You can move all grid lines around like that, at design time.

You can also designate certain grid lines as splitters, so users can resize fields with the mouse, at run time. To do it, hold down the shift and control keys, then right click on a grid line. You will get a menu with the following options:

Fixed Spacing

Splitter

Insert Division

Delete Division

Clean-up Grid

Click Splitter. The grid line will become dotted, indicating it will be used as a splitter at run time. You can do this with horizontal grid lines as well. Try to make the line between the State and Comments fields a splitter. The form should look like this:

Run the project and try out the splitter bars. They will move between the two adjacent grid lines, in the vertical or horizontal directions. Not too hard to do, and using only a single Elastic control to handle all the resizing.

To master the Elastic's new grid mode, there is one more capability we have not covered. You can make parts of the grid fixed, so they are not resized with the form. If you stretch the form shown above horizontally, you will get something like this:

The space on the left got stretched, but the labels are still the same size. This looks a little odd, and is a waste of space. To prevent this from happening, you can make the first two grid columns fixed, so they will not expand when the form is resized.

Stop the project, then hold down the shift and control keys and right-click on the first segment of any horizontal grid line. You should get the same popup menu you saw before.

Now click on Fixed Spacing. Repeat the operation for the next column. The Elastic will show that those columns are fixed by displaying locks across the top of the columns, like this:

Try running the form again and resizing it horizontally. This time, the label space will remain constant, and the text boxes will be stretched:

Remember, the regular Elastic properties still apply in grid mode. You can control the space around the grid with the BorderWidth and the width of the grid lines with the ChildSpacing properties.


Create the controls, then add the Grid

In the previous section we started with the grid, and then added controls.

You may prefer to work the other way around. Forget about the grid initially, and design your form the normal way. Then, when you are done, let the Elastic create the grid for you automatically.

Of course, once the grid is created you may still modify it with the design time commands we used earlier to tweak the grid's appearance and behavior.

For this second example, we will design a form that looks like a File Open dialog.

Start by placing an Elastic on the form and setting the following properties:

Align = asFill ' 5

Appearance = apFlat ' 0

ChildSpacing = 0 ' Pixels

TagWidth = 1000 ' Twips

You cannot see the Elastic on the form anymore, but do not worry about it. Now add the controls that make up the File Open dialog. There is quite a few of them:

The form has a DriveListBox, four small command buttons, a ListBox, a TextBox, a ComboBox, and three big command buttons (Open, Close, Help). To get all these controls properly aligned, spaced, and sized, we used Visual Basic's Format menu quite a bit.

Instead of labels, we set the Tag property for a few of the controls. Because the Elastic's TagWidth property is set to 1000, the Elastic takes care of labeling the controls.

This is a good time to save your form, just in case (too bad there's no Undo for changes in the form layout).

Adding an Elastic Grid to this form is simply a matter of setting the Elastic's AutoSizeChildren to 8 - azGrid. The Elastic will realize that you are switching to grid mode, and since there are some controls already on the form it will create a grid automatically. Here is what the form looks like now:

The Elastic created a 13 by 10 grid and adjusted it to the controls it found on the form. Pretty easy, huh?

To finish this form, set the Fixed Spacing option for a few of the rows and columns, so the list box and text boxes resize with the form, but not the buttons.

To do this, hold down the shift and control keys, then right click on the grid lines and select the Fixed Spacing option. Red padlock icons will appear near the edges of the Elastic to show which parts of the grid are fixed. The finished form will look like this:

The form is ready. Run it and see what happens when you resize it.


Grid Mode Reference

The Elastic has six properties that affect its behavior in Grid mode:

AutoSizeChildren

This property must be set to 8 - azGrid.

GridRows and GridCols

These properties must be set to the number of rows and columns that the grid is supposed to have. When you first set these properties, the rows and columns have the same size. You may modify the number, size, and properties of each grid row and column using the design-time mouse commands discussed later. Or, you may have the Elastic automatically generate the grid for you based on an existing control layout.

Grid

This property allows you to set and retrieve grid properties at run time. You may resize rows and columns, create new divisions, create splitters, and so on.

BorderWidth and ChildSpacing

These properties affect the grid as well as the other sizing modes. BorderWidth determines the distance between the edges of the control and its client area, and ChildSpacing determines the distance between adjacent controls.

The diagram below shows the effect of all these properties:


Design-time Mouse Commands

Once you have a grid set up, you can edit it at design time using the mouse.

The Elastic uses the shift-control key combination to avoid interference with regular design-time mouse commands.

To resize a grid row or column, press and hold the control and shift keys, then click on a division and drag it. When you release the mouse, the grid will resize and the child controls will snap to the new grid layout.

If you start resizing a grid row or column and change your mind, press the Escape key before you release the mouse. This will cancel the resizing.

Note: The design time commands do not work in the Visual C++ dialog editor. To edit the Elastic grid in Visual C++, use the grid editor provided via the Elastic's Main property page.


The Grid Context Menu

Each grid row and column has a set of properties that govern its run time behavior. To edit these properties, press and hold the control and shift keys, then click on a division.

You will see the Grid context menu, which looks like this:

Depending on which row or column you click, certain options might be disabled. The menu has five options:

Fixed Spacing

This option toggles the Fixed Spacing status of the row or column that was clicked. By default, Fixed Spacing is off, which means that the row or column is resized proportionally whenever the control is resized.

If you set Fixed Spacing to true, then the row or column retains its size when the control is resized.

Rows and columns with fixed spacing are indicated visually at design time by red padlock icons.

Splitter

This option toggles the Splitter status of the row or column that was clicked. By default, Splitter is off.

If you set Splitter to true, then the user will be able to move that grid element at run time, thereby resizing controls on the form. The range of each splitter is determined by the adjacent rows.

Splitter rows and columns are indicated visually at design time by gray bars.

Insert Division

This option inserts a division to the right or below the division that was clicked.

Delete Division

This option deletes the division that was clicked.

Clean up Grid

This option removes all grid divisions that do not have any controls bound to them. The main use for this option is when you start your design with a dense grid, for flexibility, and then wish to remove the extra divisions that are not being used.


Automatically Setting the Layout

The design-time commands give you a lot of flexibility in designing the form, but sometimes you may wish more accurate control over the placement of the controls on the form.

In these cases, you may prefer to place all controls on the Elastic before turning on the grid mode. When you are done, switch the AutoSizeChildren property to 8 - azGrid. The Elastic will create the rows and columns automatically, based on the position of its child controls.


The Grid Editor

Instead of editing the grid using the design-time editing commands, you may prefer to use the Grid Editor (new in SizerOne version 7.0). The grid editor offers a lot more power than the design-time commands, allowing you to resize multiple rows or columns at a time, set precise size values, and more.

Furthermore, the design-time editing commands are not available in certain host environments (Visual C++, for example). In these environments, you have to use the grid editor to set up the grid.

To invoke the grid editor, right-click on the Elastic control and select Properties to display the Elastic's property pages. On the Main property page, click the Grid Editor button. (If the button is disabled, set the AutoSizeChildren property to 8 - azGrid to enable it.)

The grid editor will display a window similar to the one shown below:

The grid editor displays a copy of the Elastic control being edited (without any child controls). Initially, the Elastic control has tags on the center of each column. The tags display the width of each column (in twips) and may be used to select one or more columns. To select a single column, click its tag. To extend the selection, shift-click other tags.

The editor has a toolbar across the top with buttons that allow you to perform several editing functions:

The first button toggles the editor between the column and row editing modes.

The edit control displays the width (height) of the current selection. You may set the width (height) of all selected columns (rows) by typing a new value into the editor and hitting Enter.

The check mark button has the same effect as hitting Enter: it applies the value (width or height) in the edit control to the current selection.

The plus button increases the size of the selection by one pixel. In most monitors, one pixel corresponds to about 15 twips.

The minus button decreases the size of the selection by one pixel. In most monitors, one pixel corresponds to about 15 twips.

The equals sign button makes all selected columns (rows) the same size. The selection does not have to be contiguous.

The lock button is used to toggle the fixed state of the current selection. (Fixed rows and columns are not resized when the control is resized.)

The splitter button is used to toggle the splitter state of the current selection. (Splitter rows and columns may be dragged with the mouse at run time.)

To add or delete a division, use the grid editor's context menu. Right-click on a division with the mouse and you will get a menu similar to the one used with the design-timer editor. The menu has options for adding and deleting rows and columns.

When you are done editing, click the OK button and the changes you made to the grid layout will be applied to the underlying control.

Note that the grid editor gives you a lot of flexibility when setting up the grid, but there are certain things you cannot do. For example:

•

You cannot make all divisions fixed. When the control is resized, at least one division must be resized so that the grid can be expanded to fit the new control size.

•

You cannot set division sizes to completely arbitrary values. Ultimately, the grid is displayed on the screen, so all dimensions need to be converted into pixels. This may introduce some round-off errors, which should not be noticeable on the screen.


The TabOne Control

Before you can use a TabOne control in your application, you must add the SIZERONE.OCX file to your project. If you use the control in most of your VB projects, you may want to add it to VB's Autoload file.

To distribute applications you create with the TabOne control, you must install and register it on the user's computer. The Setup Wizard provided with Visual Basic provides tools to help you do that. Please refer to the Visual Basic manual for details.

The TabOne Tutorial describes the following procedures:

•

Creating the Tab control.

•

Setting the Caption property to create as many tabs as you need.

•

Creating a Picture Box or Elastic control for each tab.

•

Populating each tab page.

•

Setting other IndexTab properties as desired.

That is it. You just created a fully functional tabbed form, with tab pages that switch and resize automatically.


TabOne Tutorial

Before you start following the tutorial, you need to start Visual Basic and load the SizerOne ActiveX control library. For information on how to load ActiveX controls, see the Visual Basic documentation.

Step 1: Create a new TabOne control

Create a new TabOne control on your form just like you would create any other control: Click the tool for the TabOne control on Visual Basic's Toolbox, then move the pointer onto the form. The pointer will become a cross hair. Place the cross hair near the top left corner of the form. Hold the left mouse button, drag the cross hair to a point near the bottom right corner of the form, and then release the button.

Step 2: Create the tabs

To create the tabs, you need to set the TabOne's Caption property. Select the control you just created by clicking on it, then press F4 to bring up the property window. Highlight the Caption property and type the following:

Visual &Basic|Visual &C++|&ActiveX Controls

You have just created three tabs, complete with underlined accelerator keys. The text for each individual tab is delimited by pipe characters ("|"). Each tab has its own accelerator key, defined by the ampersand ("&").

The form now looks like this:

Alternatively, you could invoke the TabOne's property pages and set each tab's caption and picture.

Step 3: Create a page for each tab

Click the tool for the Elastic control on Visual Basic's Toolbox, then move the pointer onto the Tab control, where it says "Place Container Control Here". Hold the left mouse button, drag the cross hair to a point near the bottom of the Tab control, and then release the button.

The Tab will stretch the Elastic control automatically, to fill the entire tab area.

If this were a real application, now would be the time to design the first page. To speed up our tutorial, though, just place a single command button in the middle of the page.

The form now looks like this:

To create the next page, activate the second tab by clicking on it with the mouse. If you prefer to use the keyboard, you can also activate the second tab by pressing F4 to bring up the property window, then changing the CurrTab property to 1.

The second tab will be activated, and since there is no second page yet, you will see the "Place Container Control Here" message again. Repeat the steps outlined above to create a new Elastic on the second page. Place a new command button on it.

Repeat the above steps once again to create the third page.

Note that you should create the pages in the proper order--first the page for tab 0, then the page for tab 1, and finally the page for tab 3. This is because whenever you see the "Place Container Control Here" message, the next container control created is assigned to the first tab that does not yet have a page, not to the current tab.

But do not worry. If the pages get out of synch with the tabs, that is very easy to fix, as you will see in a minute.

Step 4: Customize the appearance of the tabs

The TabOne control offers extensive control over the appearance of the tabs. The easiest way to customize the tabs is to use the Template property to select a predefined style and then adjust it by setting individual properties.

Select the Tab control by clicking on it, then press F4 to bring up the property window (click on the tabs themselves, otherwise you will probably select the page instead of the Tab control).

Highlight the Template property and set it to 4 - ttpBerkeley. This will automatically set the Position, Style, Font, and all color properties.

The form now looks like this:

The skeleton of the Tab control is ready. If you want to test the control, run the application as it is and click on the tabs. The control will automatically switch pages whenever the current tab changes. You can also switch tabs using the accelerator keys or the arrow keys. Stop the application when you are done testing it.

Step 5: Design the Pages

The last step is to design each page by placing on it the controls that your application requires. Of course, this step depends entirely on the nature of your application. Let us place a few controls on the first page just to illustrate the general procedure.

Switch to the first tab using the mouse or the Properties Window. Now you are ready to start working on the contents of the first page.

Start by setting the Elastic's Appearance property to 0 - apFlat. Now place three text boxes on the right-hand side of the page. Align them to the top, center, and bottom of the page, leaving room for the command button. Move the command button if you have to, and change its Caption property to "&Ok".

The form now looks like this:

Add some labels to identify the text boxes if you like. When you are done with the first page, select the second tab as you did before, with the mouse or using the Properties Window. This will bring up the second page, and you can design it just like you did the first.

When you are done with all pages, select the tab that you would like to appear when your application starts, then save your project. This will ensure that the current tab will begin your application.

Congratulations! You have just finished the TabOne tutorial.


TabOne Advanced Topics

The previous section explained how to set up a TabOne control. This section discusses a few more advanced topics, including:

•

How to edit the order of the tab pages,

•

How to use a single tab page instead of one page per tab,

•

How to create controls that appear on all pages, and

•

How to add and remove tabs and pages at run time.

Editing the Order of the Tabs

Using a Single Tab Page

Controls that Appear on all Pages

Adding and Removing Tabs at Run Time


Editing the Order of the Tabs

The TabOne tutorial described how to create tabs from scratch. But what if you want to add tabs after design, or to change the tab order for an existing Tab control? There is an easy way to do that.

Say you want to change our three-tab tutorial application by adding a new tab between the first and second tabs. The first thing you need to do is add the new tab. You can create the new tab using the Tabs property page or by changing the Caption property to the following string:

Visual &Basic|Add-&Ins|Visual &C++|&ActiveX Controls

Next, stretch the control horizontally so all tabs are visible. The TabOne control supports automatic tab scrolling and multiple tab rows, but for now it will be easier to work if all tabs are visible.

The new tab, Add-Ins, has been created but it does not yet have a page attached to it. To fix this, activate the last tab using the mouse or the Properties Window. Because there is a page missing, the "Place Container Control Here" message will appear when you select the last tab. Create the new page.

Now you have the right number of pages, but they are in the wrong order. This is the interesting part.

Set the CurrTab property to -1, either using the Properties Window or clicking the tab that is already current. This will tile all pages within the Tab control so they all become visible. Setting the CurrPage property to -1 means "show all pages at once."

Now that you can see all pages in order, click on the last page (the one you just created) and drag it to its proper position (right after the first page). The Tab control will tile all pages again so they remain organized.

The picture below shows how to do this.

You can keep dragging pages around until you get the page order you want. When you are happy with the order, activate the first tab again, using the mouse or the Properties Window.

Everything is back to normal, and the tab order is now correct.


Using a Single Tab Page

The TabOne control will automatically switch pages when the user selects a new tab. When there are not enough pages to display, the control will display the last page. This behavior allows you to use a single page and simply customize it when the user switches tabs.

This technique is especially effective when all pages have a consistent look.


Controls that Appear on all Pages

Sometimes it may be desirable to create controls that appear on all tabs (e.g., OK and Cancel buttons). The easiest way to do this using the vsIndexTab control is to create these controls outside the IndexTab and then just drag them over the tab area.

Because the new controls do not belong to any page, they will remain visible when you switch tabs.


Adding and Removing Tabs at Run Time

Adding and removing tabs at runtime is easy.

To add a tab, start by using the AddTab method to add the tab, then use the AttachPageToTab method to attach a control to the new tab. The specified control will become a tab page and will be displayed whenever the new tab is selected by the user.

To remove a tab, start by using the RemoveTab method to remove the tab, then remove the corresponding page by setting its Visible property to False or by changing its Container property.

The SizerOne distribution disk includes samples (in VB and VC++) that show how to add and remove tabs at run time.


The AwkOne Control

Before you can use an AwkOne control in your application, you must add the AWKONE.OCX file to your project. If you use the control in most of your VB projects, you may want to add it to VB's Autoload file.

To distribute applications you create with the AwkOne control, you must install and register it on the user's computer. The Setup Wizard provided with Visual Basic provides tools to help you do that. Please refer to the Visual Basic manual for details.

The AwkOne is the most unusual of the controls in the SizerOne package, because it is the least visual of the three. However, once you have become accustomed to its text parsing capabilities, you will probably find it very useful.

The AwkOne control allows you to quickly scan and parse text files. It is the ideal tool for doing simple data manipulation -- changing its format, checking its validity, retrieving items, generating reports, and the like -- without having to write a lot of code to scan and parse files.

The AwkOne control is similar to the original AWK language in concept and purpose; however, as the Awk control is embedded in Visual Basic, it is substantially different in syntax. The most apparent omission is a pattern matching mechanism, which in Visual Basic is provided by its Like operator.

The simplest way to use the AwkOne control is to set its FileName property to the name of a file you want to work with, set the Action property to 0 - acScan and supply a Scan event handler to collect the information you want. The Awk control will read the file, one line at a time, parse the line into fields according to the FS property, and fire the Scan event for each line.

The following topics show three examples of tasks you can accomplish with the AwkOne control:

•

Parsing text files.

•

Parsing grid clip strings.

•

Creating a calculated text box.


Parsing Text Files

The following code counts the words in a text file using the AwkOne control, without any string or file statements:

awk.FileName = Filename

awk.Action = acScan

' Gets called right after the file is opened

Sub awk_Begin ()

NWords = 0

End Sub

' Gets called after each line is read

Sub awk_Scan ()

NWords = NWords + awk.NF ' number of fields = number of words

End Sub

' Gets called right after the file is closed

Sub awk_End ()

MsgBox Filename & " has " & Format$(NWords) & " words."

End Sub

You can easily access individual fields using the F property. Suppose, for example, that you wanted to add all the values on the second field of a file imported from a spreadsheet program.

The code below shows how this is done.

awk.FileName = "spread.txt"

awk.Action = acScan

' Gets called after the file is opened

Sub awk_Begin ()

Total = 0

End Sub

' Gets called after each line is read

Sub awk_Scan ()

Total = Total + Val(awk.F(2)) ' second field

End Sub

' Gets called after the file is closed

Sub awk_End ()

MsgBox "The total is " & Format$(Total) & "."

End Sub


Parsing Grid Clip Strings

You can use the AwkOne's parsing engine with any strings--not only those read from a file. To do this, just assign the string to the L (Line) property, and read the fields one by one.

This is especially useful when you store strings clipped from a grid control. Such strings contain fields separated by line breaks (vbCR) and tabs (vbTab). You can then use two Awk controls, one to split the rows and one to split the columns, like this:

awk1.FS = vbCR ' to break the string into rows

awk2.FS = vbTab ' to break each row into columns

awk1 = Clipstring

For i = 1 To awk1.NF ' Awk1.NF is the number of rows

awk2 = awk1.F(i) ' parse ith line

For j = 1 to awk2.NF ' Awk2.NF is the number of columns

A(i, j) = Val(awk2.F(j))

Next

Next


Creating a Calculated Text Box

You can use the AwkOne's expression evaluator to create user-friendly data entry controls such as calculated text boxes.

Your users will certainly appreciate being able to type "1234.23*0.085=" in a "Sales Tax" text box instead of having to use a calculator.

The following code replaces expressions with their values whenever the user hits the equals ("=") key:

Sub Text1_KeyPress(KeyAscii as Integer)

If KeyAscii = Asc ("=") Then

v = awk.Eval(Text1)

If awk.Error = 0 then

Text1 = Format(v)

Else

Beep

End If

KeyAscii = 0

End If

Exit Sub


ElasticOne Reference

All of the properties, events, and methods for the ElasticOne control are listed below.


ElasticOne Properties

AccessibleDescription Property

AccessibleName Property

AccessibleRole Property

AccessibleValue Property

Align Property (ElasticOne)

Appearance Property (ElasticOne)

AutoSizeChildren Property

BorderWidth Property (ElasticOne)

CaptionPos Property (ElasticOne)

CaptionStyle Property (ElasticOne)

ChildSpacing Property

FloodColor Property

FloodDirection Property

FloodPercent Property

FloodStyle Property

FontResize Property

ForeColorDisabled Property

Frame Property

FrameColor Property

FrameShadow Property

FrameStyle Property

FrameWidth Property

FreezeElastics Property

Grid Property

GridCols Property

GridRows Property

MaxChildSize Property

MinChildSize Property

PicturePos Property (ElasticOne)


AccessibleDescription Property

Gets or sets the description of the control used by accessibility client applications.

Syntax

Property AccessibleDescription As String

Data Type

String


AccessibleName Property

Gets or sets the name of the control used by accessibility client applications.

Syntax

Property AccessibleName As String

Data Type

String


AccessibleRole Property

Gets or sets the role of the control used by accessibility client applications.

Syntax

Property AccessibleRole As Variant

Data Type

Variant


AccessibleValue Property

Gets or sets the value of the control used by accessibility client applications.

Syntax

Property AccessibleValue As String

Data Type

String


Align Property (ElasticOne)

Returns or sets how the control aligns itself to its parent.

Syntax

[form!]ElasticOne.Align[ = AlignSettings ]

Remarks

The Align property is similar to Visual Basic's standard Align property, except for the following:

•

It has an additional setting: 5 - asFill, which causes the Elastic to fill all the client area of its container.

•

It works even when the Elastic control is inside another control. (The standard Visual Basic Align property only works when the control is placed on the form.)

•

After the Elastic control realigns itself to its container, it fires the RealignFrame event. This is similar to the Form's object Resize event.

•

The Align property depends on the control's Z-order. The control in the back (last in the ZOrder, and typically the first created) gets aligned first, and the remaining controls use the remaining space in their increasing ZOrder.

If you align an Elastic to the top of the form, then create another and align it to the left, your form will look like this:

If you align an Elastic to the left of the form, then create another and align it to the top, your form will look like this:

The difference is related to the order in which controls were created (ZOrder). You may change this at design time using Visual Basic's Format|Order command or at runtime using the ZOrder method.

These extra capabilities make the Align property extremely powerful. Use it with the AutoSizeChildren and FontResize properties to handle all resizing on any form.

Data Type

AlignSettings (Enumeration)


Appearance Property (ElasticOne)

Returns or sets whether an object is painted with 3-D effects.

Syntax

Property Appearance As AppearanceSettings

Remarks

Valid settings for the Appearance property are described below:

Constant | Value | Description
apFlat | 0 | Flat appearance
ap3D | 1 | 3D appearance
apRaised | 2 | Raised appearance
apInset | 3 | Inset
apRaisedLight | 4 | Raised Light
apInsetLight | 5 | Inset Light
apXPThemes | 6 | XP Themes

NOTE: The apXPThemes setting will make the control use XP themes if they are available and enabled (see notes below). In the C1Elastic, XP themes affect the way in which progress bars and control borders are painted. If you select this style and XP themes are not available, then the control will be painted with a flat appearance.

NOTES ON XP THEMES:

XP themes are available only to applications running under Windows XP. To enables styles, the application must have a manifest file instructing it to use the latest version of the Microsoft common controls (6.0.0.0). The manifest file should have the name of the application's executable file with a '.manifest' extension appended in the same directory where the executable is located (or it can be embedded into the application's executable file exe, see below).

Even on an XP machine and the proper manifest file, the XP themes will only be visible when you run the application's exe. Themes will not be displayed when you run the application in debug mode from within Visual Basic.

EXAMPLE:

To enable XP themes for an application called Project1.exe, the manifest file should be called "Project1.exe.manifest", should be located in the same directory as Project1.exe, and should contain the following xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

<description>Application manifest</description>

<dependency>

<dependentAssembly>

<assemblyIdentity

type="win32"

name="Microsoft.Windows.Common-Controls"

version="6.0.0.0"

processorArchitecture="X86"

publicKeyToken="6595b64144ccf1df"

language="*"

/>

</dependentAssembly>

</dependency>

</assembly>

You can also embed the manifest into the executable file. In this case, you won't need the separate manifest file. The manifest file should be embedded into the executable using a resource editor. The manifest should be embedded as a resource of type RT_RESOURCE and ID 1. For details on this procedure, please refer to MSDN (Using Themes with Windows XP).

Data Type

AppearanceSettings (Enumeration)


AutoSizeChildren Property

Returns or sets how the control resizes the controls inside it.

Syntax

[form!]ElasticOne.AutoSizeChildren[ = AutoSizeSettings ]

Remarks

This is the most important property in the Elastic control. It governs how the Elastic's child controls are resized and moved during resizing. Together with the Align and FontResize properties, it governs most of the Elastic's resizing capabilities.

The settings for the AutoSizeChildren property are described below:

0 - azNone

This setting disables the Elastic's auto sizing.

1 - azEvenHorz, 3 - azEvenVert

These settings distribute all child controls evenly across or down the Elastic control. You can add, delete, or reorder controls inside the Elastic by moving them around with the mouse. These settings are useful to implement button panels, tool bars, and data-entry forms.

2 - azUnevenHorz, 4 - azUnevenVert

These settings are similar to the azEvenHorz and azEvenVert settings, except only the topmost control is resized. These settings are useful to implement status bars and split (Windows Explorer-type) forms. If you set the Splitter property to True, then the user can resize the controls at runtime using the mouse.

5 - azElastHorz, 6 - azElastVert

These settings are similar to the azEvenHorz and azEvenVert settings, except they only affect nested Elastics.

7 - azProportional

This setting keeps the relative size and position of all child controls constant when the Elastic is resized.

8 - azGrid

This is the most powerful setting. The Grid mode resembles a piece of graph paper, and each control occupies one or more of the little boxes on the paper. When you resize the Elastic, the graph paper stretches, and the controls move with it. The size of the grid is determined by the GridRows and GridCols properties.

The spacing around and between the child controls is determined by the BorderWidth and ChildSpacing properties.

The AutoSizeChildren property works even at design time, so you can use it as a layout tool in addition to supplying dynamic resizing capabilities to your applications. If this feature get in the way of designing the form, you can temporarily disable automatic resizing by setting the FreezeElastics property to False.

Data Type

AutoSizeSettings (Enumeration)


BorderWidth Property (ElasticOne)

Returns or sets the width (in pixels) of the border around the control.

Syntax

[form!]ElasticOne.BorderWidth[ = value As Integer ]

Remarks

The BorderWidth property determines the distance between the edges of the Elastic and its child controls when they are repositioned by the AutoSizeChildren property.

It also affects the display of the Elastic's Caption and Picture, and the display of the flooded area of the Elastic when the FloodPercent property is used.

Data Type

Integer


CaptionPos Property (ElasticOne)

Returns or sets the position of the control's caption and tag labels.

Syntax

[form!]ElasticOne.CaptionPos[ = CaptionPosSettings ]

Remarks

The CaptionPos property determines the alignment of the Caption string within the Elastic's client area. The size of the client area is determined by the control's size and the value of the BorderWidth property.

It also determines the alignment of tag labels, if the Elastic is configured to display them. For details on tag labels, see the TagWidth, TagPosition, and TagSplit properties.

Data Type

CaptionPosSettings (Enumeration)


CaptionStyle Property (ElasticOne)

Returns or sets the text style.

Syntax

[form!]ElasticOne.CaptionStyle[ = CapStyleSettings ]

Remarks

The CaptionStyle property determines how text (caption and tag labels) are drawn.

Valid settings for the CaptionStyle property are described below:

Constant | Value | Description
csFlat | 0 | Flat text.
csRaised | 1 | Raised text (use with large fonts).
csInset | 2 | Inset text (use with large fonts).
csRaisedLight | 3 | Raised light text (use with small fonts).
csInsetLight | 4 | Inset light text (use with small fonts).

Data Type

CapStyleSettings (Enumeration)


ChildSpacing Property

Returns or sets the spacing in pixels between the control's children.

Syntax

[form!]ElasticOne.ChildSpacing[ = value As Integer ]

Remarks

The ChildSpacing property determines the distance between child controls when they are repositioned by the AutoSizeChildren property.

It also determines the distance between tag labels and their attached controls, if the Elastic is configured to display tag labels. For details on tag labels, see the TagWidth, TagPosition, and TagSplit properties.

Data Type

Integer


FloodColor Property

Returns or sets the color used to fill the control when it is used as a progress indicator.

Syntax

[form!]ElasticOne.FloodColor[ = colorref& ]

Remarks

See the FloodPercent property for details on using the Elastic as a progress indicator.

Data Type

Color


FloodDirection Property

Returns or sets the direction used to fill the control when it is used as a progress indicator.

Syntax

[form!]ElasticOne.FloodDirection[ = FloodDirSettings ]

Remarks

See the FloodPercent property for details on using the Elastic as a progress indicator.

Data Type

FloodDirSettings (Enumeration)


FloodPercent Property

Returns or sets the percentage of progress when the control is used as a progress indicator.

Syntax

[form!]ElasticOne.FloodPercent[ = value As Integer ]

Remarks

When the Elastic control is used as a progress indicator, the following properties affect its behavior:

Property

Effect

FloodPercent

Sets how much of the control is flooded.

FloodStyle

Sets how the flooded part of the control is painted.

FloodColor

Sets the color used to flood the control.

FloodDirection

Sets the direction of flooding (e.g. fill to the right, fill down)

Picture

Sets the picture used to fill the control when FloodStyle is set to 2 - fsPicture.

PicturePos

Sets how the picture is adjusted to fill the flooded area when FloodStyle is set to 2 - fsPicture.

NOTE: If you set FloodPercent to a value smaller than zero or greater than 100, the Elastic will adjust the value to fit within the accepted range and will not trigger any errors.

Data Type

Integer


FloodStyle Property

Returns or sets the flood style.

Syntax

[form!]ElasticOne.FloodStyle[ = FloodStyleSettings ]

Remarks

The FloodStyle property determines how the flooded part of an Elastic is painted. Valid settings are described below:

Constant | Value | Description
fsSolid | 0 | Flooded part is filled with the color set by the FloodColor property.
fsBlocks | 1 | Flooded part is filled with blocks of the color set by the FloodColor property. (This setting results in an effect similar to the one displayed by the ProgressBar common control that ships with Visual Basic.)
fsPicture | 2 | Flooded part is filled with the picture set by the Picture property. The PicturePos property determines whether the picture is clipped, stretched, or tiled to fill the flooded part of the control.

See the FloodPercent property for details on using the Elastic as a progress indicator.

Data Type

FloodStyleSettings (Enumeration)


FontResize Property

Returns or sets whether the control automatically resizes fonts at run time.

Syntax

[form!]ElasticOne.FontResize[ = {True | False} ]

Remarks

When FontResize is set to True and the Elastic control is resized, it resizes its font and applies the new font to all its child controls.

The only font attributes applied to the child controls are the font's name and size. Any special effects such as bold and italics are preserved. This gives you extra flexibility when designing the form.

This property works at run time only.

NOTE: Font resizing works best with TrueType fonts such as Arial, Times New Roman, Tahoma, or Verdana. Other (bitmapped) fonts such as the default MS Sans Serif do not scale well, and may look quite bad when resized.

Data Type

Boolean


ForeColorDisabled Property

Returns or sets the text color to be used when the control is disabled.

Syntax

[form!]ElasticOne.ForeColorDisabled[ = colorref& ]

Remarks

If you set this property to zero, the Elastic ignores it and paints all text (caption and tag labels) using the ForeColor property.

Data Type

Color


Frame Property

Returns or sets whether frames are drawn around child controls and the control's client area.

Syntax

[form!]ElasticOne.Frame[ = FrameSettings ]

Remarks

The settings for the Frame property are described below:

Constant | Value | Description
fcNone | 0 | No frames are drawn.
fcWindowed | 1 | Frames are drawn around windowed controls.
fcNotWindowed | 2 | Frames are drawn around non-windowed controls (e.g. labels).
fcChildren | 3 | Frames are drawn around all child controls.
fcClient | 4 | A frame is drawn around the Elastic's client area (determined by the BorderWidth property) .
fcAll | 7 | Frames are drawn around all the client area and all child controls.

Other properties that affect how frames are displayed are: FrameStyle, FrameWidth, FrameColor, and FrameShadow.

Data Type

FrameSettings (Enumeration)

Default Value

fcChildren (3)


FrameColor Property

Returns or sets the color of solid frames and highlights drawn around child controls.

Syntax

[form!]ElasticOne.FrameColor[ = colorref& ]

Data Type

Color


FrameShadow Property

Returns or sets the color of shadow frames and shadows drawn around child controls.

Syntax

[form!]ElasticOne.FrameShadow[ = colorref& ]

Data Type

Color


FrameStyle Property

Returns or sets the style of frame to draw around child controls.

Syntax

[form!]ElasticOne.FrameStyle[ = FrameStyleSettings ]

Remarks

The settings for the FrameStyle property are described below:

Constant | Value | Description
ftNone | 0 | No frames are drawn.
ftSolid | 1 | Solid frames drawn with FrameColor color .
ftRaised | 2 | Raised frames drawn with FrameColor and FrameShadow colors.
ftInset | 3 | Inset frames drawn with FrameColor and FrameShadow colors.
ftFillet | 4 | Fillets drawn with FrameColor and FrameShadow colors.
ftGroove | 5 | Grooves drawn with FrameColor and FrameShadow colors.
ftShadow | 6 | Shadow rectangles drawn with FrameShadow color.

The width of the frames is determined by the FrameWidth property.

Data Type

FrameStyleSettings (Enumeration)

Default Value

ftNone (0)


FrameWidth Property

Returns or sets the width of the frames drawn around child controls.

Syntax

[form!]ElasticOne.FrameWidth[ = value As Integer ]

Data Type

Integer

Default Value

1


FreezeElastics Property

Temporarily disables the automatic alignment feature for all Elastics on all forms.

Syntax

[form!]ElasticOne.FreezeElastics[ = {True | False} ]

Remarks

The value of this property is shared by all Elastics. If you set this property to True, all Elastics will stop resizing and realigning themselves automatically. This can make it easier for you to select them with the mouse and arrange them on the form. When you set it to False, all Elastics will resume their normal behavior.

This property is available at design-time only.

Data Type

Boolean

Default Value

False


Grid Property

Returns or sets parameters for the sizing grid (active when AutoSizeChildren is set to 'azGrid'.)

Syntax

[form!]ElasticOne.Grid(Setting As GridSettings, [ Index As Variant ])[ = value As Variant ]

Remarks

The Setting parameter determines the type of property you want to inspect or modify. Some settings require you to specify a row or column index, others do not. The table below lists all the settings:

Global Settings (Index parameter not required)

Constant | Value | Description
gsRows | 0 | Sets or returns the number of grid rows. This is equivalent to the GridRows property.
gsCols | 1 | Sets or returns the number of grid columns. This is equivalent to the GridCols property.

Row Settings (Index parameter must be a value between 0 and GridRows - 1)

Constant | Value | Description
gsRowTop | 2 | Returns the y coordinate of the specified row, in twips.
gsRowHeight | 4 | Sets or returns the height of the specified row, in twips.
gsRowFixed | 6 | Sets or returns whether the height of the specified row is automatically adjusted when the control is resized.
gsRowSplitter | 8 | Sets or returns whether the bottom of the specified row may be dragged with the mouse at run time.
gsInsertRow | 10 | Setting to True inserts a row after the given row.
gsDeleteRow | 12 | Setting to True deletes the specified row.

Column Settings (Index parameter must be a value between 0 and GridCols - 1)

Constant | Value | Description
gsColLeft | 3 | Returns the x coordinate of the specified column, in twips.
gsColWidth | 5 | Sets or returns the width of the specified column, in twips.
gsColFixed | 7 | Sets or returns whether the width of the specified column is automatically adjusted when the control is resized.
gsColSplitter | 9 | Sets or returns whether the right of the specified column may be dragged with the mouse at run time.
gsInsertCol | 11 | Setting to True inserts a column after the given column.
gsDeleteCol | 13 | Setting to True deletes the specified column.

This property is useful when you want to build a resizing grid at run time, or modify an existing grid to obtain a different layout for the form. The distribution package includes samples that illustrate these techniques.

Note that you cannot make the last row or column work as splitters, since resizing them would require resizing the control.

Also note that when setting row heights and column widths, the values are rounded to the nearest pixel, and may thus be slightly off the original value. Furthermore, resizing a single row or column will cause other rows and columns to be resized as well, since the sum lf all rows and columns must fit within the control.

Use this property only if you need to modify a grid at run time. To create a grid at design time, use the Elastic's Grid editor.

Data Type

Variant


GridCols Property

Returns or sets the number of columns when AutoSizeChildren is set to 'azGrid'.

Syntax

[form!]ElasticOne.GridCols[ = value As Integer ]

Remarks

See the Grid property.

Data Type

Integer


GridRows Property

Returns or sets the number of rows when AutoSizeChildren is set to 'azGrid'.

Syntax

[form!]ElasticOne.GridRows[ = value As Integer ]

Remarks

See the Grid property.

Data Type

Integer


MaxChildSize Property

Returns or sets the maximum size (in twips) for the control's children.

Syntax

[form!]ElasticOne.MaxChildSize[ = value As Long ]

Remarks

The size corresponds to the width or height of the child controls, depending on the setting of the AutoSizeChildren property.

The size limit applies only to child controls being set to an even size. Therefore, it does not apply to any controls when the AutoSizeChildren property is set to 7 - azProportional or 8 - azGrid. It also does not apply to the topmost child control when AutoSizeChildren is set to 2 - azUnevenHorz, or 4 - azUnevenVert.

This property is useful to prevent controls from becoming too tall or too wide. Command buttons, for example, can look strange if they are too wide.

Setting this property to zero disables it.

Data Type

Long

Default Value

0


MinChildSize Property

Returns or sets the minimum size (in twips) for the control's children.

Syntax

[form!]ElasticOne.MinChildSize[ = value As Long ]

Remarks

The size corresponds to the width or height of the child controls, depending on the setting of the AutoSizeChildren property.

The size limit applies only to child controls being set to an even size. Therefore, it does not apply to any controls when the AutoSizeChildren property is set to 7 - azProportional or 8 - azGrid. It also does not apply to the topmost child control when AutoSizeChildren is set to 2 - azUnevenHorz, or 4 - azUnevenVert.

This property is useful to prevent controls from becoming too short or too narrow. Command buttons, for example, can become unusable if they are too narrow.

Setting this property to zero disables it.

Data Type

Long

Default Value

0


PicturePos Property (ElasticOne)

Returns or sets the position of the picture in the control.

Syntax

[form!]ElasticOne.PicturePos[ = PicturePosSettings ]

Remarks

All pictures are drawn within the Elastic's borders, determined by the BorderWidth property.

The settings for the PicturePos property are described below:

Constant | Value | Description
ppLeftTop | 0 | Align picture to left top corner of the control's client area.
ppLeftCenter | 1 | Align picture to left and to the center of the control's client area.
ppLeftBottom | 2 | Align picture to left bottom corner of the control's client area.
ppCenterTop | 3 | Align picture to center and to the top of the control's client area.
ppCenterCenter | 4 | Align picture to center of the control's client area.
ppCenterBottom | 5 | Align picture to center and to the bottom of the control's client area.
ppRightTop | 6 | Align picture to right top corner of the control's client area.
ppRightCenter | 7 | Align picture to right and to the center of the control's client area.
ppRightBottom | 8 | Align picture to right bottom corner of the control's client area.
ppStretch | 9 | Stretch the picture so it fills the control's client area.
ppTile | 10 | Copy the picture, in its original size, until it fills the control's client area.
ppZoom | 11 | Stretch the picture so it fills the control's client area, while keeping its original aspect ratio.

When using the Elastic as a progress indicator, you can flood the control by stretching or tiling the Picture over the flooded area. To do that, set the FloodStyle property to 2 - fsPicture and set the PicturePos property to 9 - ppStretch or 10 - ppTile.

Setting 11 - ppZoom is often the best choice for displaying pictures of unknown dimensions -- possibly selected by the user at run time. This setting will result in the best match between control and picture size, while at the same time avoiding distortions (the picture will be stretched evenly in the horizontal and vertical directions).

Data Type

PicturePosSettings (Enumeration)


ElasticOne Events

RealignFrame Event

ResizeChildren Event

ResizeGridCol Event

ResizeGridRow Event

Splitter Property

Style Property (ElasticOne)

TagPosition Property

TagSplit Property

TagWidth Property

Template Property (ElasticOne)

Version Property (ElasticOne)

WordWrap Property


RealignFrame Event

Fired after the control is moved or resized.

Syntax

Private Sub ElasticOne_RealignFrame()

Remarks

This event fires when the control's position or size change after it realigns itself to the container, as specified by the Align property.

This event is analogous to the Resize event provided by Visual Basic's forms.


ResizeChildren Event

Fired after the control resizes its children.

Syntax

Private Sub ElasticOne_ResizeChildren()

Remarks

This event fires after the control repositions its child controls, as specified by the AutoSizeChildren property .


ResizeGridCol Event

Fired after the user resizes a grid column using a splitter bar.

Syntax

Private Sub ElasticOne_ResizeGridCol( ByVal Col As Integer)

Remarks

This event fires when the AutoSizeChildren property is set to 8 - azGrid, after the user resizes a grid column with the mouse. The grid column must be a splitter column.

To make a grid column a splitter, use the grid editor at design time, or use the Grid property at run time to set gsColSplitter to True for the column.


ResizeGridRow Event

Fired after the user resizes a grid row using a splitter bar.

Syntax

Private Sub ElasticOne_ResizeGridRow( ByVal Row As Integer)

Remarks

This event fires when the AutoSizeChildren property is set to 8 - azGrid, after the user resizes a grid row with the mouse. The grid row must be a splitter row.

To make a grid row a splitter, use the grid editor at design time, or use the Grid property at run time to set gsRowSplitter to True for the row.


Splitter Property

Returns or sets whether the control acts as a splitter (AutoSizeChildren must be set to uneven).

Syntax

[form!]ElasticOne.Splitter[ = {True | False} ]

Remarks

If Splitter is set to True and AutoSizeChildren is set to 2 - azUnevenHorz or 4 - azUnevenVert, the Elastic works as a splitter, allowing the user to drag the border between adjacent controls to a new location using the mouse.

This property is obsolete and is available only for backward-compatibility. New applications should provide splitter capabilities by setting the AutoSizeChildren property to 8 - azGrid and using the grid editor to determine which grid divisions should behave as splitters.

Data Type

Boolean


Style Property (ElasticOne)

Returns or sets whether the control looks and behaves like a panel or a frame.

Syntax

[form!]ElasticOne.Style[ = ElasticStyleSettings ]

Remarks

This property allows you to use the Elastic to create frames similar to the ones provided by the standard Frame control.

However, the Elastic Frames are more flexible because:

•

They provide the Elastic's standard resizing capabilities;

•

They allow you to place the Frame's caption on the top or on the bottom of the control;

•

You can align the caption to the left, center, or right of the frame using the CaptionPos property.

Data Type

ElasticStyleSettings (Enumeration)


TagPosition Property

Returns or sets where the tag labels are displayed.

Syntax

[form!]ElasticOne.TagPosition[ = TagPositionSettings ]

Remarks

For details on using tag labels, see the TagWidth property.

Data Type

TagPositionSettings (Enumeration)


TagSplit Property

Returns or sets whether the tag labels are truncated at the first pipe character (|).

Syntax

[form!]ElasticOne.TagSplit[ = TagSplitSettings ]

Remarks

The settings for the TagSplit property are described below:

Constant | Value | Description
tsNone | 0 | Use the full tag text as tag labels.
tsPipe | 1 | Use the part of the tag before the first pipe character ("|") as tag labels.
tsAlignPipe | 2 | Same as tsPipe, plus interpret the first two characters as an alignment code.

This property allows you to extend the basic tag label functionality by storing additional information in the child control's Tag property and also to override the alignment used to display individual tags.

To store additional information in the child control's Tag property, set the TagSplit property to 1 - tsPipe or 2 - tsAlignPipe and mark the end of the tag label for each control with a pipe character. For example, the following code stores tag labels and an additional help string in each child control's Tag property, then displays the help string when the mouse moves over each child control:

Sub Form_Load()

el.TagSplit = tsPipe

el.TagWidth = -100

Ctrl(0).Tag = "Label 0|Help for control 0"

Ctrl(1).Tag = "Label 1|Help for control 1"

Ctrl(2).Tag = "Label 2|Help for control 2"

End Sub

Sub Ctrl_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)

HelpLabel = Mid$(Ctrl(Index).Tag, InStr$(Ctrl(Index).Tag, "|") + 1)

End Sub

Normally, all tag labels are aligned according to the CaptionPos property. The final TagSplit setting, 2 - tsAlignPipe, allows you to override the default alignment by starting a tag with a backslash followed by a digit that corresponds to an alignment setting. The table below lists all valid settings, which correspond to the values of the Caption property settings:

Code

Alignment

"\0"

cpLeftTop

"\1"

cpLeftCenter

"\2"

cpLeftBottom

"\3"

cpCenterTop

"\4"

cpCenterCenter

"\5"

cpCenterBottom

"\6"

cpRightTop

"\7"

cpRightCenter

"\8"

cpRightBottom

For example, the following code aligns the first two labels to the top left corner of the tag rectangle, and the third to the bottom right:

Sub Form_Load()

el.TagSplit = tsAlignPipe

el.TagWidth = -100

Ctrl(0).Tag = "\0Label 0|Align left top"

Ctrl(1).Tag = "\0Label 1|Align left top"

Ctrl(2).Tag = "\8Label 2|Align right bottom"

End Sub

Other properties that affect tag labels are TagWidth and TagPosition.

Data Type

TagSplitSettings (Enumeration)


TagWidth Property

Returns or sets the width of the captions (tag labels) created from the tag property of child controls.

Syntax

[form!]ElasticOne.TagWidth[ = value As Long ]

Remarks

This property allows you to use the Tag property of the Elastic's children as labels, rather than using label controls. This can save valuable labels, and facilitates form design because:

•

When you move the controls, the labels go with them.

•

If the controls are aligned, the labels are aligned.

•

If you change the Elastic's font, all labels automatically use the new font.

Tag labels can be placed on the left, right, above, or below the control being labeled, depending on the setting of the TagPosition property.

When TagPosition is set to 0 - tgLeft or 3 - tgRight, the labels have the same height as the controls being labeled. The width of the labels is determined by the TagWidth property, as explained below.

When TagPosition is set to 1 - tgAbove or 3 - tgBelow, the labels have the same width as the controls being labeled. The height of the labels is determined by the TagWidth property, as explained below.

Positive TagWidth values are interpreted as the absolute label sizes, measured in Twips.

For example, if you set the TagWidth to 1000, the tag labels will always be 1000 Twips wide (or high).

Negative TagWidth values are interpreted as percentages of the size of the control being labeled. For example, if you set TagWidth to -50, the tag labels will always be half as wide (or high) as the controls being labeled.

Here are some examples that show typical uses for this property (the code assumes an Elastic control named el):

' keep the labels always as wide as the controls:

el.TagPosition = tgLeft

el.TagWidth = -100 ' 100%

' keep the labels 1000 Twips wide:

el.TagPosition = tgLeft

el.TagWidth = 1000 ' 1000 twips

' keep the labels as tall as the controls:

el.TagPosition = tgAbove

el.TagWidth = -100 ' 100%

' keep the labels 100 Twips tall:

el.TagPosition = tgAbove

el.TagWidth = 100 ' 100 twips

Setting TagWidth to zero disables the tag labels.

Label justification is determined by the CaptionPos property. The appearance and behavior of the tag labels is also affected by the WordWrap and Font properties. The distance between the tag labels and the controls is determined by the ChildSpacing property.

If you change a control's Tag property at runtime, you must tell the Elastic to update the tag label. You can accomplish this with the Refresh method, as in the example below:

' assuming Text1 is inside el

Text1.Tag = "New Label"

el.Refresh

Data Type

Long


Template Property (ElasticOne)

Sets a number of other properties to achieve a pre-defined look.

Syntax

[form!]ElasticOne.Template = ElasticTemplateSettings

Remarks

The Template property provides a convenient way to customize several other properties at once. You may choose the template that most closely approximates the look and feel you want, then refine it further by adjusting other properties.

Setting the Template property sets the following properties:

Property | tpDataEntry | tpToolbar | tpStatusLine
Align | asNone | asTop | asBottom
AutoSizeChildren | azEvenVert | azEvenHorz | azEvenHorz
BorderWidth | 6 | 6 | 6
CaptionPos | cpLeftCenter | cpLeftCenter | cpLeftCenter
ChildSpacing | 4 | 1 | 1
MaxChildSize | 0 | 400 | 400
MinChildSize | 0 | 400 | 400
PicturePos | cpCenterCenter | cpCenterCenter | cpCenterCenter
Style | esClassic | esClassic | esClassic
TagWidth | -100 | 0 | 0

This property is write-only. After you select a template at design-time, the value shown in the Properties Window will automatically revert to 0 - tpNone.

Data Type

ElasticTemplateSettings (Enumeration)


Version Property (ElasticOne)

Returns the version of the control.

Syntax

[form!]ElasticOne.Version[ = value As Integer ]

Remarks

You may want to check this value at the Form_Load event, to make sure the version that is executing is at least as current as the version used to develop your application.

The version number is a three digit integer where the first digit represents the major version number and the last two represent the minor version number. For example, version 7.00 returns 700.

This property is read-only.

Data Type

Integer


WordWrap Property

Determines whether text is allowed to wrap.

Syntax

[form!]ElasticOne.WordWrap[ = {True | False} ]

Remarks

This property determines whether the caption text should be automatically broken between words if a word would extend past the edge of the control. Return characters may also be used to break lines.

If an Elastic has room for only one line of text and a caption with several words, word wrapping may hide parts of the caption. In such cases, setting this property to False may improve readability.

This property also affects the tag labels, if they are enabled (see the TagWidth property).

Data Type

Boolean


TabOne Reference

All of the properties, events, and methods for the TabOne control are listed below.


TabOne Properties

AccessibleDescription Property (TabOne)

AccessibleName Property (TabOne)

AccessibleRole Property (TabOne)

AccessibleValue Property (TabOne)

Appearance Property (TabOne)


AccessibleDescription Property (TabOne)

Gets or sets the description of the control used by accessibility client applications.

Sytntax

Property AccessibleDescription As String

Data Type

String


AccessibleName Property (TabOne)

Gets or sets the name of the control used by accessibility client applications.

Syntax

Property AccessibleName As String

Data Type

String


AccessibleRole Property (TabOne)

Gets or sets the role of the control used by accessibility client applications.

Syntax

Property AccessibleRole As Variant

Data Type

Variant


AccessibleValue Property (TabOne)

Gets or sets the value of the control used by accessibility client applications.

Syntax

Property AccessibleValue As String

Data Type

String


Appearance Property (TabOne)

Returns or sets whether an object is painted with 3-D effects.

Syntax

Property Appearance As TabAppearanceSettings

Remarks

Valid settings for the Appearance property are described below:

Constant | Value | Description
tapFlat | 0 | Flat appearance
tap3D | 1 | 3D appearance
tap3DLight | 2 | 3D Light
tapXPThemes | 3 | XP Themes

NOTE: The new setting will make the control use XP themes if they are available and enabled (see below). In the C1Tab, XP themes affect the way in which tabs are painted. If you select this style and XP themes are not available, then the control will be painted with a flat appearance.

NOTES ON XP THEMES:

XP themes are available only to applications running under Windows XP. To enables styles, the application must have a manifest file instructing it to use the latest version of the Microsoft common controls (6.0.0.0). The manifest file should have the name of the application's executable file with a '.manifest' extension appended in the same directory where the executable is located (or it can be embedded into the application's executable file exe, see below).

Even on an XP machine and the proper manifest file, the XP themes will only be visible when you run the application's exe. Themes will not be displayed when you run the application in debug mode from within Visual Basic.

EXAMPLE:

To enable XP themes for an application called Project1.exe, the manifest file should be called "Project1.exe.manifest", should be located in the same directory as Project1.exe, and should contain the following xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

<description>Application manifest</description>

<dependency>

<dependentAssembly>

<assemblyIdentity

type="win32"

name="Microsoft.Windows.Common-Controls"

version="6.0.0.0"

processorArchitecture="X86"

publicKeyToken="6595b64144ccf1df"

language="*"

/>

</dependentAssembly>

</dependency>

</assembly>

You can also embed the manifest into the executable file. In this case, you won't need the separate manifest file. The manifest file should be embedded into the executable using a resource editor. The manifest should be embedded as a resource of type RT_RESOURCE and ID 1. For details on this procedure, please refer to MSDN (Using Themes with Windows XP).

Data Type

TabAppearanceSettings (Enumeration)


TabOne Methods

AddTab Method

Align Property (TabOne)

AttachPageToTab Method

AutoScroll Property

AutoSwitch Property

BackColor Property

BackTabColor Property

BoldCurrent Property

BorderWidth Property (TabOne)

Caption Property

CaptionEmpty Property

CaptionPos Property (TabOne)

CaptionStyle Property (TabOne)

ClientHeight Property

ClientLeft Property

ClientTop Property

ClientWidth Property

CurrTab Property

DogEars Property

FirstTab Property

ForeColor Property

FrontTabColor Property

FrontTabForeColor Property

GetTab Property

MouseOver Property

MultiRow Property

MultiRowOffset Property

NumTabs Property

Picture Property

PicturePos Property (TabOne)

Position Property

RemoveTab Method

Scroll Event

Separators Property

ShowFocusRect Property

Style Property (TabOne)

Switch Event

TabCaption Property

TabColor Property

TabData Property

TabEnabled Property

TabHeight Property

TabOutlineColor Property

TabPicture Property

TabPreview Property

TabsPerPage Property

TabVisible Property

Template Property (TabOne)

Version Property (TabOne)


AddTab Method

Adds a tab to the control.

Syntax

[form!]TabOne.AddTab Caption As String, [ Position As Variant ], [ Picture As Variant ]

Remarks

The parameters for the AddTab method are described below:

Caption As String

Contains the caption for the new tab. Use an ampersand to specify an accelerator key for the new tab. You may change the caption later using the TabCaption property.

Position As Variant (optional)

Specifies the position (index) for the new tab. If provided, this value must be between 0 and NumTabs. If omitted, the new tab is inserted at the end of the list and becomes the last tab.

Picture As Variant (optional)

Allows you to specify a picture to attach to the new tab. You may change the picture later using the TabPicture property.

Note: This method adds a tab to the control, but it does not automatically connect the new tab to a "page". For that, use the AttachPageToTab method.


Align Property (TabOne)

Returns or sets how the control aligns itself to its parent.

Syntax

[form!]TabOne.Align[ = AlignSettings ]

Remarks

The Align property is similar to Visual Basic's standard Align property, except for the following:

•

It has an additional setting: 5 - asFill, which causes the Tab control to fill all the client area of its container.

•

It works even when the Tab control is inside another control. (The standard Visual Basic Align property only works when the control is placed on the form.)

•

The Align property depends on the control's Z-order. The control in the back (last in the ZOrder, and typically the first created) gets aligned first, and the remaining controls use the remaining space in their increasing ZOrder.

These extra capabilities make the Align property extremely powerful. Use it with the AutoSizeChildren and FontResize properties to handle all resizing on any form.

Data Type

AlignSettings (Enumeration)


AttachPageToTab Method

Attaches a page to a given tab.

Syntax

[form!]TabOne.AttachPageToTab Page As Variant, Position As Long

Remarks

The AddTab method allows you to add tabs to the control at run time. After adding a tab, use the AttachPageToTab method to connect the new tab to a new "page".

The parameters for the AttachPageToTab method are described below:

Page As Variant

Contains a reference to the new "page" control. In Visual Basic, this parameter should contain a reference to a container control. In Visual C++, this parameter should contain a reference to a container control's window. For more details, see the examples below.

Position As Long

Determines which tab the new page should be attached to. This value should be in the range between zero and NumTabs.

Using the AttachPageToTab method in Visual Basic is very easy. The example below shows how you can add a tab to the control and then attach a page to the new tab. The new tab is created at position 3. When the user selects the new tab, the control will display the control elNewPage in its client area. The code assumes that tb is a Tab control and that elNewPage is a control that contains all the controls that make up the new page (tb and elNewPage should be on the same form):

tb.AddTab "&New Page", 3

tb.AttachPageToTab elNewPage, 3

Using the AttachPageToTab method in Visual C++ is a little different. Because VC++ does not provide extender controls with a Container property, the Page parameter should be a window handle instead of a control reference. The code below is the VC++ equivalent of the previous example:

m_tb.AddTab("&BNew Page", COleVariant(3L), COleVariant(0L, VT_ERROR));

m_tb.AttachPageToTab(COleVariant((long)m_elNewPage.GetHWnd()), 3);


AutoScroll Property

Returns or sets whether the control automatically scrolls to keep the current tab visible.

Syntax

[form!]TabOne.AutoScroll[ = {True | False} ]

Remarks

If AutoScroll is set to True, the controls scrolls the tabs automatically to ensure that the current tab is always visible.

Scrolling the tabs is necessary when there is a single row of tabs that is wider than the control itself.

After the control scrolls the tabs, it fires the Scroll event.

Data Type

Boolean

Default Value

True


AutoSwitch Property

Returns or sets whether the control automatically switches pages when the current tab changes.

Syntax

[form!]TabOne.AutoSwitch[ = {True | False} ]

Remarks

If AutoSwitch is set to True, the IndexTab control switches tab pages automatically when a new tab is selected. It will also resize the current page to fit the IndexTab's client area.

The size of the client area is determined by the size and position of the tabs plus a border that is set using the BorderWidth property.

The Tab control fires the Switch event before each switch, so you can validate the current page and even cancel the switch. The Tab control fires the Click event after the switch, so you can update the form based on the new selection.

To use the AutoSwitch feature, you will typically create one "page" (container control) for each tab. The Tab control then takes care of switching and resizing the pages whenever a tab is selected. To determine which page belongs to each tab, the Tab control assumes that the leftmost page belongs to the first tab, the second from the left to the second tab, and so on.

The AutoSwitch feature also works at design time. To activate a tab, click on it with the mouse. The tab will become active, and its container will be displayed just as it would at runtime. This makes form design easy. To associate containers to tabs, click on the current tab. This causes all tabs to be de-selected and the containers to be tiled. Reorganize the tabs by dragging them around until they are in the proper order.

If AutoSwitch is on and CurrTab is set to a number greater than the number of pages, the last page is shown. This is useful if you have a single page in the Tab control because it automatically sizes the page when the control is resized.

NOTE: When the Tab control switches the current tab, it enables the current page and disables all others. This is done to prevent users from activating hidden controls by mistake, using the keyboard. If you need to enable and disable controls inside a Tab control, you can either (1) enable and disable the controls within each page, or (2) nest two container controls on each page, then enable and disable the inner one with code while the Tab control handles the outer one.

Data Type

Boolean

Default Value

True


BackColor Property

Returns or sets the color used for painting the object's background.

Syntax

[form!]TabOne.BackColor[ = colorref& ]

Remarks

The BackColor property is used to paint the empty area of the control, behind the tabs.

The FrontTabColor is used to paint the front tab and the edges of the control. The BackTabColor property is used to paint the non-selected tabs.

You may override the color used to paint any individual tab using the TabColor() property.

The diagram below shows which property determines the color of each part of the control.

Data Type

Color


BackTabColor Property

Returns or sets the color of all non-selected tabs.

Syntax

[form!]TabOne.BackTabColor[ = colorref& ]

Remarks

See the BackColor property.

Data Type

Color


BoldCurrent Property

Returns or sets whether the current tab is displayed with a bold font.

Syntax

[form!]TabOne.BoldCurrent[ = {True | False} ]

Data Type

Boolean

Default Value

False


BorderWidth Property (TabOne)

Returns or sets the width in pixels of the border between the control and its pages.

Syntax

[form!]TabOne.BorderWidth[ = value As Integer ]

Remarks

The border is automatically used by the Tab control to position pages when the AutoSwitch property is set to True.

You can retrieve the size of the Tab's client area using the ClientLeft, ClientTop, ClientWidth, and ClientHeight properties. This may be useful in case you want to position controls over the Tab's client area.

Data Type

Integer


Caption Property

Returns or sets the tab text (e.g. Tab1|Tab2|Tab3).

Syntax

[form!]TabOne.Caption[ = value As String ]

Remarks

Use the pipe character ("|") to separate options. For example, "Tab1|Tab2|Tab3".

Use a dash ("-") followed by spaces to create an invisible tab between regular tabs. For example, "Tab1|- Tab2|Tab3" will create two visible tabs with a gap between them. This feature is useful if you want to crate group of tabs.

Each tab may have an accelerator key (marked with an ampersand -&) to allow for fast tab switching.

To set the caption for individual tabs, use the TabCaption property.

Data Type

String


CaptionEmpty Property

Returns or sets a caption to be displayed at runtime when no tab is selected (CurrTab = -1).

Syntax

[form!]TabOne.CaptionEmpty[ = value As String ]

Data Type

String


CaptionPos Property (TabOne)

Returns or sets the position of the caption within each tab.

Syntax

[form!]TabOne.CaptionPos[ = CaptionPosSettings ]

Remarks

The CaptionPos property determines the alignment of the caption string within each tab. By default, captions are aligned to the center of the tab.

Use the PicturePos property to select the position of the pictures within each tab.

Data Type

CaptionPosSettings (Enumeration)

Default Value

cpCenterCenter (4)


CaptionStyle Property (TabOne)

Returns or sets the text style.

Syntax

[form!]TabOne.CaptionStyle[ = CapStyleSettings ]

Remarks

The CaptionStyle property determines how text is drawn within each tab.

Valid settings for the CaptionStyle property are described below:

Constant | Value | Description
csFlat | 0 | Flat text.
csRaised | 1 | Raised text (use with large fonts).
csInset | 2 | Inset text (use with large fonts).
csRaisedLight | 3 | Raised light text (use with small fonts).
csInsetLight | 4 | Inset light text (use with small fonts).

Data Type

CapStyleSettings (Enumeration)

Default Value

csFlat (0)


ClientHeight Property

Returns the dimensions in Twips of the control's client (page) area.

Syntax

val& = [form!]TabOne.ClientHeight

Remarks

This property is useful if you want to size frames or picture controls so that they occupy the whole client area of the control. This is necessary only if the AutoSwitch property is set to False.

This property and its companions ClientLeft, ClientTop, and ClientWidth are read-only.

Data Type

Long


ClientLeft Property

Returns the dimensions in Twips of the control's client (page) area.

Syntax

val& = [form!]TabOne.ClientLeft

Data Type

Long


ClientTop Property

Returns the dimensions in Twips of the control's client (page) area.

Syntax

val& = [form!]TabOne.ClientTop

Data Type

Long


ClientWidth Property

Returns the dimensions in Twips of the control's client (page) area.

Syntax

val& = [form!]TabOne.ClientWidth

Data Type

Long


CurrTab Property

Returns or sets the current tab.

Syntax

[form!]TabOne.CurrTab[ = value As Integer ]

Remarks

The first tab is numbered zero. Setting this property to a negative value or to a value greater than the number of tabs causes all tabs to be de-selected. No error occurs.

When you set this property, the following actions will occur:

•

The Switch event will be fired. If you do not cancel the switch, then

•

The new tab will be brought into view, scrolling the tabs if necessary;

•

The current tab's page will be disabled and hidden from view;

•

The new tab's page will be enabled and brought into view;

•

The Click event will be fired.

This is the default property for the Tab control.

Data Type

Integer


DogEars Property

Returns or sets whether the control displays scroll buttons.

Syntax

[form!]TabOne.DogEars[ = {True | False} ]

Remarks

The scroll buttons look like and behave the arrow keys displayed at each end of a scroll bar.

This property only works when the MultiRow property is set to False (when MultiRow is True, all tabs are automatically displayed and there is no need for scrolling.)

Data Type

Boolean

Default Value

True


FirstTab Property

Returns or sets the number of the first tab to be displayed.

Syntax

[form!]TabOne.FirstTab[ = value As Integer ]

Remarks

The Tab control may have more tabs than will fit the control at one time.

If the MultiRow property is set to True, tabs will wrap and all tabs will be visible at all times. If MultiRow is set to False, the control will scroll the tabs so that the current tab is always visible.

If the AutoScroll property is set to True, the control will handle scrolling automatically. Otherwise, you can implement scrolling yourself, using the FirstTab property to select the first tab that should be displayed by the control .

Whenever FirstTab changes, the control fires the Scroll event.

Data Type

Integer


ForeColor Property

Returns or sets the color used for painting the object's text.

Syntax

[form!]TabOne.ForeColor[ = colorref& ]

Remarks

The ForeColor property determines the color used to draw the text in non-selected tabs. The FrontTabForeColor property determines the color used to draw the text in the selected tab.

The TabOutlineColor property determines the color used to draw the border around flat controls.

Data Type

Color


FrontTabColor Property

Returns or sets the color of the current tab and front page of the control.

Syntax

[form!]TabOne.FrontTabColor[ = colorref& ]

Remarks

See the BackColor property.

Data Type

Color


FrontTabForeColor Property

Returns or sets the color of the current tab's caption.

Syntax

[form!]TabOne.FrontTabForeColor[ = colorref& ]

Remarks

See the ForeColor property.

Data Type

Color


GetTab Property

Returns the tab page where a given control is located.

Syntax

val% = [form!]TabOne.GetTab(hWnd As Long)

Remarks

This property is only useful if the control has an hWnd property.

If you pass GetTab an invalid window handle, or a window that does not belong to any tab, GetTab will return the value -1.

This property is read-only.

Data Type

Integer


MouseOver Property

Returns the index of the tab currently under the mouse cursor, or -1 if the mouse is not over any tabs.

Syntax

val% = [form!]TabOne.MouseOver

Remarks

This read-only property is useful when you want to provide dynamic help while the user moves the mouse over different tabs.

Tabs are numbers from zero to NumTabs - 1. If the mouse is not over any tabs, MouseOver returns -1.

For example, the following code displays tooltips describing each tab as the user moves the mouse over the control:

Private Sub tab_MouseMove(Button As Integer, _

Shift As Integer, _

X As Single, Y As Single)

' same as last time? quit and avoid flicker

Static last%

If last = tab.MouseOver + 1 Then Exit Sub

' save tab for next time

last = tab.MouseOver + 1

' update ToolTipText

If last > 0 Then

.ToolTipText = "This is tab " & last

Else

.ToolTipText = ""

End If

End Sub

Data Type

Integer


MultiRow Property

Returns or sets whether the tabs are displayed in multiple rows.

Syntax

[form!]TabOne.MultiRow[ = {True | False} ]

Remarks

If MultiRow is set to False, tabs are allowed to continue beyond the visible area of the control, scrolling into view as needed. You may set the DogEars property to True to provide scroll buttons.

If MultiRow is set to True, multiple tab rows are created so that all tabs are visible. You may set the TabsPerPage property to determine how many tabs will be displayed in each row.

The appearance of the multiple rows can be modified using the MultiRowOffset property.

Data Type

Boolean


MultiRowOffset Property

Returns or sets the offset, in Twips, between successive tab rows.

Syntax

[form!]TabOne.MultiRowOffset[ = value As Long ]

Remarks

This property only works if MultiRow is set to True.

Data Type

Long

Default Value

200


NumTabs Property

Returns the number of tabs currently defined.

Syntax

val% = [form!]TabOne.NumTabs

Remarks

This property is set automatically whenever the Caption or TabCaption properties are modified.

This property is read-only.

Data Type

Integer


Picture Property

Returns or sets the picture in the current tab.

Syntax

[form!]TabOne.Picture[ = Picture ]

Remarks

This property allows you to set pictures on each tab at design time. Just select a tab by clicking on it with the mouse, and set its picture using the property window. Alternatively, you may set each tab's picture using the Tab's property page.

To get or set tab pictures at run time, use the TabPicture property.

Data Type

Picture


PicturePos Property (TabOne)

Returns or sets the position of the picture within each tab.

Syntax

[form!]TabOne.PicturePos[ = TabPicturePosSettings ]

Remarks

The settings for the PicturePos property are described below:

Constant | Value | Description
tppAuto | 0 | Pictures are drawn above the text if the Position property specifies vertical tabs, or to the left of the text if the Position property specifies horizontal tabs.
tppSide | 1 | Pictures are drawn on the left, text on the right of the tab.
tppTop | 2 | Pictures are drawn on the top, text on the bottom of the tab.

Use the CaptionPos property to set the alignment of the caption text within each tab.

Data Type

TabPicturePosSettings (Enumeration)

Default Value

tppAuto (0)


Position Property

Returns or sets the position of the tabs within the control.

Syntax

[form!]TabOne.Position[ = TabPositionSettings ]

Remarks

The settings for the Position property are described below:

Constant | Value | Description
tpTop | 0 | Tabs are drawn across the top of the control.
tpBottom | 1 | Tabs are drawn across the bottom of the control.
tpLeft | 2 | Tabs are drawn on the left of the control.
tpRight | 3 | Tabs are drawn on the right of the control.
tpRightIn | 4 | Tabs are drawn on the right of the control, with text facing into the control.
tpLeftHorz | 5 | Tabs are drawn on the left of the control, with horizontal text.
tpRightHorz | 6 | Tabs are drawn on the right of the control, with horizontal text.

Note: Windows only supports vertical text with TrueType fonts. If you set the Position property to one of the vertical settings, make sure you select a TrueType font such as Arial, Times New Roman, Tahoma, or Verdana.

The diagram below illustrates the effect of each setting:

Data Type

TabPositionSettings (Enumeration)

Default Value

tpTop (0)


RemoveTab Method

Removes a tab from the control.

Syntax

[form!]TabOne.RemoveTab Position As Long


Scroll Event

Fired after the FirstTab property changes.

Syntax

Private Sub TabOne_Scroll()

Remarks

The Tab control may have more tabs than will fit the control at one time.

If the MultiRow property is set to True, tabs will wrap and all tabs will be visible at all times. If MultiRow is set to False, the control will scroll the tabs so that the current tab is always visible.

If the AutoScroll property is set to True, the control will handle scrolling automatically. Otherwise, you can implement scrolling yourself, using the FirstTab property.


Separators Property

Returns or sets whether separator lines are drawn instead of background tabs.

Syntax

[form!]TabOne.Separators[ = {True | False} ]

Remarks

Setting Separators to True causes the control to draw separator lines between background tabs instead of drawing the full tab. The Separators property works with all tab styles and positions.

Data Type

Boolean

Default Value

False


ShowFocusRect Property

Returns or sets whether the control shows a focus rectangle.

Syntax

[form!]TabOne.ShowFocusRect[ = {True | False} ]

Remarks

The focus rectangle is drawn around the current tab when the control has the focus.

Data Type

Boolean

Default Value

True


Style Property (TabOne)

Returns or sets the style used to draw the tabs.

Syntax

[form!]TabOne.Style[ = TabStyleSettings ]

Remarks

The Style property has seven settings. It can be combined with the Appearance, Position, and Separators properties to provide great control over the way the Tab looks.

The settings for the Style property are illustrated in the picture below:

Data Type

TabStyleSettings (Enumeration)

Default Value

tsStraight (3)


Switch Event

Fired before the current tab is changed (Click is fired after).

Syntax

Private Sub TabOne_Switch(OldTab As Integer, NewTab As Integer, Cancel As Integer)

Remarks

The parameters for the Switch event are described below:

Parameter | Description
OldTab | Holds the value of the current tab (before the switch).
NewTab | Holds the value of the tab that is about to become current. You may modify this value to activate a different tab.
Cancel | Set this parameter to True to cancel the switch (OldTab remains current.)

This event is useful when you have to validate data or save the contents of controls on the current tab page before switching tabs.

Note: To update the display after a tab switch, trap the Click event instead.


TabCaption Property

Returns or sets the caption for a given tab.

Syntax

[form!]TabOne.TabCaption(Index As Integer)[ = value As String ]

Remarks

Use this property to dynamically change the text in individual tabs. The Caption property can be used to set or return the text for all tabs at once.

You may create multi-line tab captions by assigning strings containing line breaks (vbCrLf) to the TabCaption property.

You can change the color, picture, visibility, and enabled state of a tab using the TabColor, TabPicture, TabVisible, and TabEnabled properties.

Tabs are numbered from zero to NumTabs - 1. Trying to get or set a TabCaption outside this range will trigger an invalid index error.

Note: In previous versions of the Tab control, you could create tabs by assigning a string with embedded pipe characters to a TabCaption (e.g. TabCaption(0)="Tab1|New Tab"), and delete tabs by assigning them an empty string (e.g. TabCaption(0)=""). Although this is still supported for compatibility with existing code, new applications should use the AddTab and RemoveTab methods instead.

Data Type

String


TabColor Property

Returns or sets the background color for a given tab.

Syntax

[form!]TabOne.TabColor(Index As Integer)[ = colorref& ]

Remarks

The default value for this property is zero, which causes the control to use the default color for painting the tab (FrontTabColor property).

You can change the caption, picture, visibility, and enabled state of a tab using the TabCaption, TabPicture, TabVisible, and TabEnabled properties.

Tabs are numbered from zero to NumTabs - 1. Trying to get or set a TabColor outside this range will trigger an invalid index error.

Data Type

Color


TabData Property

Returns or sets a user-defined value associated with the given tab.

Syntax

[form!]TabOne.TabData(Index As Integer)[ = value As Variant ]

Remarks

Use this property to store within each tab whatever information is relevant to your application.

For example, you could place a single data bound grid in a Tab control and store an SQL statement within each tab. You could then trap the Switch event to update the grid's record source when a new tab is selected.

Data Type

Variant


TabEnabled Property

Returns or sets the enabled status for a given tab.

Syntax

[form!]TabOne.TabEnabled(Index As Integer)[ = {True | False} ]

Remarks

Disabled tab captions are displayed in light gray. The user cannot activate them with the mouse or keyboard.

You can change the caption, color, picture, and visibility of a tab using the TabCaption, TabColor, TabPicture, and TabVisible properties.

Tabs are numbered from zero to NumTabs - 1. Trying to get or set a TabCaption outside this range will trigger an invalid index error.

Data Type

Boolean


TabHeight Property

Returns or sets the height, in Twips, of the tab (zero means default for current font).

Syntax

[form!]TabOne.TabHeight[ = value As Long ]

Remarks

Setting this property to zero causes the Tab control to calculate the tab height automatically to fit the current font, tab caption, and tab picture.

The tab height is measured vertically when tabs are placed along the top or bottom of the control, and horizontally when tabs are placed along the left or right side of the control. Tab placement is determined by the Position property.

Data Type

Long

Default Value

0


TabOutlineColor Property

Returns or sets the color to be used for the outline of the tabs.

Syntax

[form!]TabOne.TabOutlineColor[ = colorref& ]

Remarks

This property is only used when the Appearance property is set to 0 - tapFlat.

Data Type

Color


TabPicture Property

Returns or sets the picture to be shown on a given tab.

Syntax

[form!]TabOne.TabPicture(Index As Integer)[ = Picture ]

Remarks

You can assign bitmaps, icons or metafiles to tabs. After each picture is assigned to a tab, the control automatically resizes to fit the largest picture.

You can change the caption, color, visibility, and enabled state of a tab using the TabCaption, TabColor, TabVisible, and TabEnabled properties.

To set tab pictures at design time, use the Tabs property page.

Tabs are numbered from zero to NumTabs - 1. Trying to get or set a TabCaption outside this range will trigger an invalid index error.

Data Type

Picture


TabPreview Property

Returns or sets whether the control should track mouse movements.

Syntax

[form!]TabOne.TabPreview[ = {True | False} ]

Remarks

If you set this property to True, the control will switch tabs as the user clicks and drags the mouse over the tab area. If you set it to False, then each click generates a single switch (mouse dragging is ignored).

This property only works for single-row tabs. Multi-row tabs always behave as if TabPreview were set to False.

Data Type

Boolean

Default Value

True


TabsPerPage Property

Returns or sets the number of tabs that fit across the control.

Syntax

[form!]TabOne.TabsPerPage[ = value As Integer ]

Remarks

If this property is set to zero, the tabs are drawn as close together as possible, and each tab may have a different size.

If this property is set to a positive number n, then n tabs are shown on the page, all with the same size.

If MultiRow is set to true, this property must be set to a number greater than zero.

Data Type

Integer

Default Value

0


TabVisible Property

Returns or sets the visible status for a given tab.

Syntax

[form!]TabOne.TabVisible(Index As Integer)[ = {True | False} ]

Remarks

Setting TabVisible to False hides the specified tab and its associated page. The user cannot activate hidden pages with the mouse or keyboard, but the programmer can activate a hidden tab using code. Setting TabVisible to True makes the specified tab page visible again.

You can change the caption, color, picture, and enabled state of a tab using the TabCaption, TabColor, TabPicture, and TabEnabled properties.

Tabs are numbered from zero to NumTabs - 1. Trying to get or set the TabVisible property of a tab outside this range will trigger an invalid index error.

Data Type

Boolean


Template Property (TabOne)

Sets a number of other properties to achieve a pre-defined look.

Syntax

[form!]TabOne.Template = TabTemplateSettings

Remarks

The Template property provides a convenient way to customize several other properties at once. You may choose the template that most closely approximates the look and feel you want, then refine it further by adjusting other properties.

Setting the Template property modifies all properties related to the appearance of the control. These are:

Position, Style, Appearance, Separators

PicturePos, ShowFocusRect, FontBold,

FrontTabColor, BackTabColor, BackColor,

FrontTabForeColor, ForeColor, and TabOutlineColor.

The picture below shows the effect of each setting:

This property is write-only. After you select a template at design-time, the value shown in the Properties Window will automatically revert to 0 - ttpNone.

Data Type

TabTemplateSettings (Enumeration)


Version Property (TabOne)

Returns the version of the control.

Syntax

val% = [form!]TabOne.Version

Remarks

You may want to check this value at the Form_Load event, to make sure the version that is executing is at least as current as the version used to develop your application.

The version number is a three digit integer where the first digit represents the major version number and the last two represent the minor version number. For example, version 7.00 returns 700.

This property is read-only.

Data Type

Integer


AwkOne Reference

All of the properties, events, and methods for the AwkOne control are listed in the following tables. Properties, events, and methods that apply only to this control, or that require special consideration when used with it, are marked with an asterisk (*). These are documented in later sections. For documentation on the remaining properties, see the Visual Basic documentation.


AwkOne Properties

Action Property

AngleUnits Property

Begin Event

Case Property

CurrPos Property


Action Property

Sets an action to be performed by the control.

Syntax

[form!]AwkOne.Action = ActionSettings

Remarks

The Action property is used to start and control scanning of text files.

The effect of the settings for the Action property are described below:

0 - acScan

This setting causes Awk to perform the following actions:

•

Open the file specified by the FileName property;

•

Fire the Begin event;

•

Read the file parsing each line and firing the Scan event for each one;

•

Close the file;

•

Fire the End event.

1 - acNextLine

This setting action causes Awk to read the next line from the current data file. It can be useful in the routine that handles the Scan event. If the file is not open when you set Action to acNextLine, Awk will open it for you, and you must close the file when you are done with it by setting the Action property to acClose.

2 - acClose

This setting causes Awk to close the current file and stop scanning it.

Data Type

ActionSettings (Enumeration)


AngleUnits Property

Returns or sets the units used for angles when evaluating trigonometric expressions.

Syntax

[form!]AwkOne.AngleUnits[ = AngleUnitSettings ]

Remarks

Angles are often expressed in degrees, but most trigonometric libraries require you to convert them into radians before you calculate sines, co-sines, etc. The Awk evaluator allows you to use degrees directly, by setting the AngleUnits property to 1 - auDegrees.

For example:

awk.AngleUnits = auDegrees

Debug.Print Format(awk.Eval("Cos(90)"), "0.000")

0.000

awk.AngleUnits = auRadians

Debug.Print Format(awk.Eval("Cos(90)"), "0.000")

-0.448

Data Type

AngleUnitSettings (Enumeration)

Default Value

auRadians (0)


Begin Event

Fired after file is opened for scanning.

Syntax

Private Sub AwkOne_Begin()


Case Property

Returns or sets whether lines are converted to upper or lower case as they are read.

Syntax

[form!]AwkOne.Case[ = CaseSettings ]

Remarks

The settings for the Case property are described below:

Constant | Value | Description
csNone | 0 | Do not perform any case conversion.
csUpper | 1 | Convert strings to upper case as they are read in.
csLower | 2 | Convert strings to lower case as they are read in.

Data Type

CaseSettings (Enumeration)

Default Value

csNone (0)


CurrPos Property

Returns or sets the position of the current line within the file.

Syntax

[form!]AwkOne.CurrPos[ = value As Long ]

Remarks

This property is useful when you want to save the position of current line so that you can easily return to it later.

When you get or set the CurrPos property, the file specified by the FileName property should be open. You may open the file by setting the Action property to acScan or acNextLine, or you may use the FindLine property.

After you set the CurrPos property, the file handle will be repositioned. You must then read the line by setting the Action property to acNextLine.

The example below illustrates how you can do this:

' GetStringPos ---------------------------------------------

' Look through a file for a line containing a string.

' Return the position where it was found or -1 if not found

' ----------------------------------------------------------

Function GetStringPos(fname$, fstr$) As Long

awk.FileName = fname ' set file name

awk.FindLine = fstr ' look for string

awk.Action = arClose ' close file

If awk = "" Then ' not found

GetStringPos = -1

Debug.Print fstr; " Not found in "; fname

Else ' found

GetStringPos = awk.CurrPos

Debug.Print fstr; "found at "; awk.CurrPos

End If

End Function

' ReadAtPos-------------------------------------------------

' read a line at a specified position in a file

' ----------------------------------------------------------

Sub ReadAtPos(savedpos&)

awk.Action = acNextLine ' force file open

awk.CurrPos = savedpos ' go to position

awk.Action = acNextLine ' read line

Debug.Print awk ' show line

awk.Action = acClose ' close file

End Sub

Data Type

Long


AwkOne Events

End Event

Error Property

Error Event

Eval Property

F Property

FieldAt Property

FileName Property

FileType Property

FilterQuotes Property

FindLine Property

FS Property

L Property

MatchQuotes Property

NF Property

PercentDone Property

PosAt Property

RN Property

Scan Event

Val Property

Variable Event

Version Property

MousePointerSettings Constants

AppearanceSettings Constants

ElasticTemplateSettings Constants

AlignSettings Constants

AutoSizeSettings Constants

FloodDirSettings Constants

CaptionPosSettings Constants

TagPositionSettings Constants

ElasticStyleSettings Constants

TagSplitSettings Constants

PicturePosSettings Constants

CapStyleSettings Constants

FrameSettings Constants

FrameStyleSettings Constants

FloodStyleSettings Constants

GridSettings Constants

TabAppearanceSettings Constants

TabTemplateSettings Constants

TabStyleSettings Constants

TabPositionSettings Constants

TabPicturePosSettings Constants

CaseSettings Constants

ActionSettings Constants

AwkErrorSettings Constants

FileTypeSettings Constants

AngleUnitSettings Constants


End Event

Fired after the control is done scanning a file.

Syntax

Private Sub AwkOne_End()


Error Property

Returns a code that identifies the last error trapped by the control.

Syntax

val% = [form!]AwkOne.Error

Remarks

This property is set by the control before the Error event is fired, and allows you to determine what type of error occurred.

The following errors may occur while parsing a file using the Action property:

Error Code | Value | Description
aerCantOpen | 1 | The file specified by the FileName property cannot be found.
aerLineTooLong | 2 | The file contains lines longer than 64k characters (Awk truncated the line).
aerFieldTooLong | 3 | Changing a field that would make the line longer than 64k characters.
aerBadFieldGet | 4 | Setting a field that does not exist, i.e., smaller than zero or greater than NF.
aerBadFieldSet | 5 | Getting a field that does not exist, i.e., smaller than zero or greater than NF.

The following errors may occur while evaluating a numerical expression using the Val property or the Eval method:

Error Code | Value | Description
aerSyntax | 6 | Expression has bad syntax, as in 1+/ 2.
aerBadToken | 7 | The expression has undefined variables, as in foo+bar.
aerBalance | 8 | Expression has unbalanced brackets, as in 1+(2+3.
aerDivBy0 | 9 | Tried to divide a value by zero, as in 12/(5-5).
aerDomain | 10 | Argument is not in domain of function, as in Log(-1).
aerSingularity | 11 | Expression would result in a singularity.
aerOverflow | 12 | Expression has a value too big to represent, as in Exp(1000).
aerPartialLoss | 13 | Expression result has a partial loss of significant digits.
aerTotalLoss | 14 | Expression result has a total loss of significant digits.
aerUnderflow | 15 | Expression has a value too small to represent.

Data Type

AwkErrorSettings (Enumeration)


Error Event

Fired when the control encounters an error.

Syntax

Private Sub AwkOne_Error()

Remarks

To determine what type of error triggered the Error event, check the value of the Error property.


Eval Property

Evaluates a string containing a numeric expression and returns the result.

Syntax

val# = [form!]AwkOne.Eval(Expression As String)

Remarks

This property evaluates the mathematical expression in Expression parameter and returns its value as a double. The expression may contain variables, provided you handle the Variable event.

The following operators are supported, according to their priority:

Op

Meaning

()

subexpressions

^

power

*, /

multiplication, division

%

modulus (remainder)

\

integer divide

+, -

addition, subtraction

>, >=,

logical comparison

<, <=,

<>

&, |

logical "and", logical "or"

In addition to the standard operators, the following built-in functions are supported (they are not case sensitive): Abs, Sin, Cos, Tan, ACos, ASin, Atn, Log, Log10, Exp, Sqr, Int, Frac, Ceil, and Floor. Trigonometric functions accept and return angles expressed in radians or degrees, depending on the setting of the AngleUnits property.

The Awk expression evaluator allows you to define your own variables. This is done in a very simple way. Whenever the parser encounters a string that is not a number, operator, or built-in function, it fires the Variable event. The event handler gets the variable name and is responsible for returning its value.

If an error occurs while evaluating an expression, the Error property is set to an appropriate code. See the description of the Error property to find out what each code means.

For example:

debug.print awk.Eval("(1+2)*3^2")

27

Note: This property is functionally equivalent to the Val property, except it allows you to pass the expression as a parameter, instead of relying on the L property.

Data Type

Double


F Property

Returns or sets the value of a field within the current line.

Syntax

[form!]AwkOne.F(index As Integer)[ = value As String ]

Remarks

Awk fields are obtained by parsing the contents of the current line (L property) using the symbols defined as field separators (FS property) as delimiters. The parsing is done automatically, and is affected by the settings of the FS, MatchQuotes, and FilterQuotes properties.

Fields are numbered from 1 to NF. As in the Awk language, field 0 corresponds to the whole line (record).

If you try to set or read an invalid field, Awk fires the Error event.

If you set a field to a string that contains field separators, the line is automatically re-parsed, and the NF property is updated.

For example:

awk.F(0) = "This is a string"

Debug.Print awk.NF, awk.F(0)

4 This is a string

Debug.Print awk.F(4)

string

awk.F(4) = "plain long ASCII string"

Debug.Print awk.NF, awk.F(0)

7 This is a plain long ASCII string

Data Type

String


FieldAt Property

Returns the number of the field at the specified string position.

Syntax

val% = [form!]AwkOne.FieldAt(index As Integer)

Remarks

This property was designed to be used with Visual Basic's InStr function. The first string position is 1.

This property is useful when you want to process a field based on its contents rather than on its position. See also the PosAt property, which performs the reverse function.

For example, the following code uses the PosAt property to find the contents of the field after the string "value."

' find the tag

awk = "stuff stuff stuff stuff value data stuff stuff"

debug.print awk.FieldAt(instr(awk, "value"))

5

' get the value

debug.print awk.f(5+1)

data

' one-stop shopping

debug.print awk.f(awk.FieldAt(instr(awk, "value"))+1)

data

Data Type

Integer


FileName Property

Returns or sets the name of the file to be scanned by the control.

Syntax

[form!]AwkOne.FileName[ = value As String ]

Remarks

This property specifies the name of the file to be read using the Action, CurrPos, and FindLine properties.

Data Type

String


FileType Property

Returns or sets whether the file being scanned is a text or binary file.

Syntax

[form!]AwkOne.FileType[ = FileTypeSettings ]

Remarks

The effect of the settings for the FileType property are described below:

0 - ftText

This setting causes the Awk to interpret the contents of the FileName file as text. Specifically, this means that the Awk will recognize both vbCrLf combinations and vbLf characters as line breaks, and will trim off either the end of each line. In addition, the Awk will truncate the file when it finds an end-of-file marker (Chr(6)).

1 - ftBinary

This setting tells the Awk to perform no conversions whatsoever on the file being scanned.

Data Type

FileTypeSettings (Enumeration)

Default Value

ftText (0)


FilterQuotes Property

Returns or sets whether leading and trailing quotes are trimmed (when MatchQuotes is set to True).

Syntax

[form!]AwkOne.FilterQuotes[ = {True | False} ]

Remarks

This property only works when MatchQuotes is set to True. The Awk recognizes both single and double quotes.

For example:

awk = "Name 'John McAdam' Age 23"

awk.MatchQuotes = True

awk.FilterQuotes = False

debug.print awk.F(2)

'John McAdam'

awk.FilterQuotes = True

debug.print awk.F(2)

John McAdam

Data Type

Boolean

Default Value

False


FindLine Property

Scans a file for a line containing a specified string.

Syntax

[form!]AwkOne.FindLine = value As String

Remarks

Before using this property, you must set the FileName property to the name of the file you want to scan. You don't need to open the file, the Awk will do that for you.

After setting the FindLine property, the line containing the string will be returned in the L (line) property and the CurrPos property will be set to the position within the file where the line was found. If Awk cannot find the line containing the given string, the L property is set to an empty string.

The search is case sensitive. If you want to ignore the case, set the Case property to csUpper and use an upper case search string.

For an example, see the CurrPos property.

Data Type

String


FS Property

Returns or sets the characters to be used as field separators.

Syntax

[form!]AwkOne.FS[ = value As String ]

Remarks

Each occurrence of any of the characters in the FS string marks the beginning of a new field. The only exception is that repeated spaces are equivalent to a single space.

When this property is changed, the current string is automatically re-parsed.

For example:

awk = "This is a string|||with some pipes in it"

awk.FS = " "

debug.print awk.NF, "["; awk.F(NF); "]"

8 [it]

awk.FS = "|"

debug.print awk.NF; "["; awk.F(NF); "]"

4 [with some pipes in it]

awk.FS = "| "

debug.print awk.NF; "["; awk.F(NF); "]"

11 [it]

Data Type

String


L Property

Returns or sets the value of the current line.

Syntax

[form!]AwkOne.L[ = value As String ]

Remarks

This is the Awk's default property.

You may assign a string to this property directly with code. You may then parse or evaluate the string. See the FS and F properties for more details on parsing with the Awk. See the Val property and Variable event for details on evaluating expressions with the Awk.

If you are scanning a file using the Action property, the Scan event will be fired for each line in the original file. The L property will hold the contents of each line when the Scan event is fired.

Data Type

String


MatchQuotes Property

Returns or sets whether quote-delimited strings are processed as single fields.

Syntax

[form!]AwkOne.MatchQuotes[ = {True | False} ]

Remarks

This feature was added to facilitate parsing of quote and comma-delimited files such as those exported by most database and spreadsheet programs.

Double or single quotes are both recognized, but one does not match the other. Unmatched quotes in a line are ignored. If you want the Awk to automatically remove the quotes, set the FilterQuotes property to True.

For example:

awk = "'John Doe', 24, '1244 Main Street', 645-5432"

awk.FS = ", "

awk.MatchQuotes = False

debug.print awk.NF, awk.F(1)

7 'John

awk.MatchQuotes = True

debug.print awk.NF, awk.F(1)

4 'John Doe'

awk.MatchQuotes = True

awk.FilterQuotes = True

debug.print awk.NF, awk.F(1)

4 John Doe

Data Type

Boolean

Default Value

False


NF Property

Returns the number of fields in the current line.

Syntax

val% = [form!]AwkOne.NF

Remarks

The number of fields changes whenever the current line is re-parsed. This happens when the current line changes (L and F properties), or when the field separators (FS property) change.

Data Type

Integer


PercentDone Property

Returns the percentage of the current file that has been scanned.

Syntax

val% = [form!]AwkOne.PercentDone

Remarks

This property was designed to provide a convenient way to report progress while processing long files. It can be used, for example, with the Elastic's FloodPercent property.

For example:

' inform the user and keep the UI alive while scanning files

Private Sub awk_Scan()

el.FloodPercent = awk.PercentDone

DoEvents

End Sub

Data Type

Integer


PosAt Property

Returns the position of the specified field in the current line.

Syntax

val% = [form!]AwkOne.PosAt(index As Integer)

Remarks

This property was designed to be used with Visual Basic's string functions. The first string position is 1.

This property is useful when you want to process a field based on its contents rather than on its position. See also the FieldAt property, which performs the reverse function.

For example:

' use the PosAt property to remove the first four fields from a record.

awk = "junk1 junk2 junk3 junk4 data5 data6 data7"

debug.print awk.PosAt(5)

25

debug.print Mid(awk,25)

data5 data6 data7

Data Type

Integer


RN Property

Returns the number of the current line being scanned.

Syntax

val& = [form!]AwkOne.RN

Remarks

This property is useful mainly while handling the Scan event.

Data Type

Long


Scan Event

Fired for each line in the input file while a file is scanned.

Syntax

Private Sub AwkOne_Scan()

Remarks

This event is fired for each line in the input file while Awk scans a file.

This is where you put the code that does the actual processing. The line read from the file is available through the L property.

You may close the current file or get the next input line while in this subroutine by setting the Action property to acNextLine or acClose.


Val Property

Returns the value of the expression in the Line property.

Syntax

val# = [form!]AwkOne.Val

Remarks

This property evaluates the mathematical expression in the L (line) property and returns its value as a double. The expression may contain variables, provided you handle the Variable event.

The following operators are supported, according to their priority:

Op

Meaning

()

subexpressions

^

power

*, /

multiplication, division

%

modulus (remainder)

\

integer divide

+, -

addition, subtraction

>, >=,

logical comparison

<, <=,

<>

&, |

logical "and", logical "or"

In addition to the standard operators, the following built-in functions are supported (they are not case sensitive): Abs, Sin, Cos, Tan, ACos, ASin, Atn, Log, Log10, Exp, Sqr, Int, Frac, Ceil, and Floor. Trigonometric functions accept and return angles expressed in radians or degrees, depending on the setting of the AngleUnits property .

The Awk expression evaluator allows you to define your own variables. This is done in a very simple way. Whenever the parser encounters a string that is not a number, operator, or built-in function, it fires the Variable event. The event handler gets the variable name and is responsible for returning its value.

If an error occurs while evaluating an expression, the Error property is set to an appropriate code. See the description of the Error property to find out what each code means.

For example:

awk = "(1+2)*3^2"

debug.print awk.Val

27

Data Type

Double


Variable Event

Fired when the Val property is used to evaluate a formula that contains variables.

Syntax

Private Sub AwkOne_Variable(Variable As String, Value As Double, Accept As Integer)

Remarks

This event is used with the Val property to provide evaluation of expressions that contain variables.

The parameters for the Variable event are described below:

Variable$

This parameter holds the name of the variable that needs to be evaluated.

Value#

This parameter is where the event handler must return the value of the variable.

Accept%

This parameter indicates that the variable is valid. It is False by default. If the variable name is valid, then the handler is responsible for setting this parameter to True.

Your event handler will typically read the variable name from the Variable parameter, supply its value through the Value parameter, and set the Accept flag to indicate the variable is valid. If the variable name is not valid, it will return without setting the Accept parameter and Awk will generate a "Bad Token" error.

For example, if your program defines two variables "x" and "y", your event handler might look like this:

Dim GlobalX, GlobalY

Sub awk_Variable(Variable$, Value As Double, Accept%)

Accept = True

Select Case Variable

Case "X", "x": Value = GlobalX

Case "Y", "y": Value = GlobalY

Case Else: Accept = False ' trigger error

End Select

End Sub

GlobalX = 1

GlobalY = 2

awk = "X + Y"

Debug.Print awk.Val

3


Version Property

Returns the version of the control.

Syntax

val% = [form!]AwkOne.Version

Remarks

You may want to check this value at the Form_Load event, to make sure the version that is executing is at least as current as the version used to develop your application.

The version number is a three digit integer where the first digit represents the major version number and the last two represent the minor version number. For example, version 7.00 returns 700.

This property is read-only.

Data Type

Integer

Default Value

700


Constants

This section lists all constants that may be used with the controls in this library. These constants are also listed and described in the documentation of the properties and methods to which they apply.

MousePointerSettings Constants

AppearanceSettings Constants

ElasticTemplateSettings Constants

AlignSettings Constants

AutoSizeSettings Constants

FloodDirSettings Constants

CaptionPosSettings Constants

TagPositionSettings Constants

ElasticStyleSettings Constants

TagSplitSettings Constants

PicturePosSettings Constants

CapStyleSettings Constants

FrameSettings Constants

FrameStyleSettings Constants

FloodStyleSettings Constants

GridSettings Constants

TabAppearanceSettings Constants

TabTemplateSettings Constants

TabStyleSettings Constants

TabPositionSettings Constants

TabPicturePosSettings Constants

CaseSettings Constants

ActionSettings Constants

AwkErrorSettings Constants

FileTypeSettings Constants

AngleUnitSettings Constants


Using SizerOne in Visual C++

This tutorial describes how you can use the ComponentOne SizerOne controls in Visual C++. The tutorial does not cover all aspects of using the controls. Rather, it focuses on the differences between using the controls in Visual C++ versus Visual Basic.

You can use the ComponentOne SizerOne controls in many types of VC++ applications. This tutorial describes one of them, an MFC dialog-based application. Once you understand how the controls work in this type of project, you should be able to create other types of applications as well.

Step 1: Create a new application

Step 2: Add controls to the dialog

Step 3: Attach class variables to the controls

Step 4: Add an event handler

Step 5: Create a Tab page

Step 6: Add the pages to the Tab control

APPENDIX I: AdoptChildren function


Step 1: Create a new application

To start the tutorial, run Visual C++ and create a new project. Select the File|New menu option, then select the Projects page and select the MFC AppWizard (exe) option. Enter a name and location for the new project, and then click OK.

The MFC AppWizard will appear. Select the Dialog Based option, click Finish, and then OK.

You will see the blank dialog that the MFC AppWizard created for your application. Click each control in the dialog and delete it using the DEL key.


Step 2: Add controls to the dialog

Now that you have a blank dialog, right-click on the dialog and select the Insert ActiveX control… menu option. For this tutorial, create a TabOne control and an ElasticOne control. After you have created the controls, position them on the dialog so it looks like this:

Setting control variables is as easy as in VB. Right click each control, select the Properties menu, and set the properties as you would in VB. For this application, set the ElasticOne's Align property to 2 – asBottom and set the TabOne's Align property to 5 - Fill Container. (If you cannot find a property on the regular property pages, use the last one, named All, to see all properties listed in alphabetical order).

Note that the controls do not align themselves automatically at design time (they do in VB). This is because the VC++ dialog editor does not create full working versions of the controls at design time. Do not worry, though, the controls will align and resize at run time.

To make the dialog behave like a resizable VB form, right click the dialog, select the Properties menu, select the Styles page, and then set the Border property to Resizing. To reduce flicker, also check the Clip Children checkbox.


Step 3: Attach class variables to the controls

At this point, the application already has the controls in it, but you cannot access them using code because they are not mapped onto any class variables. To do this, hold the control key while you double-click on the TabOne control. VC++ will tell you it needs to create a wrapper class for the control. Click OK to create the wrapper class, click OK again to accept the default options, then enter m_TabOne as the variable name, and click OK to finish.

Now you can use the m_TabOne member variable to access the control's properties and methods. Do the same for the ElasticOne control, and call it m_ElasticOne.

Run the project to make sure it works so far. Notice that you can resize the window and the controls will align themselves to the new window layout.


Step 4: Add an event handler

To add an event handler to a control, right click on it and select the Events… menu. The AppWizard will show a dialog listing all the controls and events available for each one. For this sample, select the IDC_TABONE control and double-click the Switch event. The AppWizard will suggest a name for the event handler. Click OK to accept the suggestion, then click Edit Existing to go to the handler implementation.

The AppWizard has added a code stub that looks like this:

void CTabOneTutDlg::OnSwitchTabone1(short FAR* OldTab, short FAR* NewTab, short FAR* Cancel)

{

// TODO: Add your control notification handler code here

}

This is similar to the empty Sub/End Sub when you create an event handler in VB. Add the following handler code to the stub:

void CTabOneTutDlg::OnSwitchTabone1(short FAR* OldTab, short FAR* NewTab,
short FAR* Cancel)

{

CString str;

str.Format("The new tab is %d.", *NewTab);

m_ElasticOne.SetCaption(str);

}

This code gets executed whenever the user selects a new tab. It displays the selection in the ElasticOne control using the member variable we added in Step 3.


Step 5: Create a Tab page

Adding pages to a tab control is very easy in VB. It is a little harder in VC++, because the resource editor is quite different and more limited than the one in VB.

The best way to add pages to a TabOne control in VC++ is to create each page as a separate dialog class, then add them to the control at runtime, by reparenting them.

To create each page, select the Insert|Resource… menu, select Dialog, and click New. Delete the controls added by the AppWizard, then right click the dialog, select the Properties menu, the Styles page, and set Styles to Child and Border to None. This will create a blank page, without a border.

Right click on the page and add the controls you want. For example, add an Elastic control, a text box and two buttons, so your dialog looks like this:

Note that when you create the controls, the resource editor places the new controls behind existing ones. To fix this so you can see all controls, select Layout|Tab Order (ctrl+D) and click each control in turn, leaving the container controls for last. When you are done, you will see all controls on the form:

Next, right-click the Elastic, select the Properties menu, select the Main property page and set the Align property to 5 - Fill Container and the AutoSizeChildren property to 8 – Grid. Click the Grid Editor button to edit the grid. Right click the bottom horizontal line and select the Splitter menu (as you would in VB). Close the property window and the Elastic will display the grid. Drag the controls so they are close to their positions on the grid, as shown below: (In VB, the controls would snap to the grid at design time. In VC++, they will snap to the grid only at run time.)

Hold down the control key and double-click the ElasticOne control to add a member variable for it. The AppWizard will tell you that it needs to create a class to encapsulate the new dialog. Click OK, and call the new class CTabPage1.

Now that the class has been defined, hold down the control key and double-click the ElasticOne control again to add the member variable. Call it m_Elastic.

Now double-click the left button and the AppWizard will create an empty stub for the event handler. Go back to the dialog and repeat this process for the second button. At this point, you will have two empty event handlers for the dialog.

Now hold down the control key and double click the Edit control. The AppWizard will prompt you for the information it needs to create a new member variable. Type m_Edit for the variable name, and select Category Control (instead of Value):

Once the control has been mapped to a variable, you can write the event-handler code, filling out the stubs as follows:

void CTabPage1::OnButton1()

{

m_Edit.SetWindowText("You clicked button 1.");

}

void CTabPage1::OnButton2()

{

m_Edit.SetWindowText("You clicked button 2.");

}

There is a subtle but important detail going on here. Usually, VC++ lets you refer to controls on a dialo by their ID, using functions such as GetDlgItem, SetDlgItemText, etc. You should not use this technique here. To make resizing work, we will re-parent the controls later, and the Dlg functions will not be able to find the controls. You should stick to control member variables, which work even if you reparent the controls.

To make the sample interesting, and to practice a little, you should create two more pages, following the same steps described above. Make the pages look a little different so you can easily tell when the user switches them. Call the new pages CPage2 and CPage3.


Step 6: Add the pages to the Tab control

Now that we have created the main window and all the tab pages, we need to add the pages to the tab control. To do this, start by opening the main dialog's include file (TabOneTutDlg.h if you selected TabOneTut as the project name) and use the #include statement to bring in the page definitions (make sure you add the #include statements before the #if !defined statement added by the AppWizard).

// TabOneTutDlg.h : header file

//

//{{AFX_INCLUDES()

#include "tabone.h"

#include "elasticone.h"

//}}AFX_INCLUDES

#include "TabPage1.h"

#include "TabPage2.h"

#include "TabPage3.h"

#if !defined(AFX_…__INCLUDED_)

#define AFX_…__INCLUDED_

…

Next, add a member variable for each page in the tab:

// Implementation

protected:

HICON m_hIcon;

CTabPage1 m_Page1;

CTabPage2 m_Page2;

CTabPage3 m_Page3;

// Generated message map functions

//{{AFX_MSG(CTabOneTutDlg)

…

Now the main dialog class has three pages, which need to be created and added to the tab control. This is done in the OnInitDialog event handler (in the TabOneTutDlg.cpp file).

BOOL CTabOneTutDlg::OnInitDialog()

{

CDialog::OnInitDialog();

…

// TODO: Add extra initialization here

// Create tab pages

// (in reverse order to get the tab sequence right)

m_Page3.Create(IDD_PAGE3);

AdoptChildren(m_Page3.m_Elastic);

m_pg3.SetParent(&m_TabOne);

m_Page3.ShowWindow(SW_NORMAL);

m_Page2.Create(IDD_PAGE2);

AdoptChildren(m_Page3.m_Elastic);

m_Page2.SetParent(&m_TabOne);

m_Page2.ShowWindow(SW_NORMAL);

m_Page1.Create(IDD_PAGE1);

AdoptChildren(m_Page1.m_Elastic);

m_Page1.SetParent(&m_TabOne);

m_Page1.ShowWindow(SW_NORMAL);

return TRUE; // return TRUE unless you set the focus to a control

}

code above repeats four steps to each page:

e1.Create(IDD_PAGE1);

This statement creates the page. At this point, the page is not visible and it does not belong to the tab control yet.

AdoptChildren(m_Page1.m_Elastic);

This statement tells the m_Elastic control on the page to "adopt" all controls that overlap it. Once the controls become children of the Elastic, they will be resized automatically.
The AdoptChildren function is provided as source code, in the SizerOneUtil.cpp file. You may either include this file in your project or simply copy the implementation into your project. (The function is listed in Appendix I below).

m_Page1.SetParent(&m_TabOne);

This statement adds the page to the Tab. Notice that the pages are added in reverse order. If this bothers you, you can add them in any order you want and reposition them using the MoveWindow API).

m_Page1.ShowWindow(SW_NORMAL);

This statement makes the page visible.

This is the end of the tutorial. It illustrates the main aspects and techniques involved in using the SizerOne controls in VC++.


APPENDIX I: AdoptChildren function

/////////////////////////////////////////////////////////////////////////////

// AdoptChildren

//

// Scans all sibling windows and reparent those which are located on top

// of the given window hwndParent.

//

// Usually, hwndParent is either an Elastic or IndexTab control that

// will take charge of resizing its children.

//

// Usually, you will call this routine from the OnInitDialog() event handler.

//

void AdoptChildren(HWND hwndParent)

{

HWND hwndChild, hwndNext;

RECT rcParent, rcChild;

// get parent rect

GetWindowRect(hwndParent, &rcParent);

// scan all controls on the form

hwndChild = GetWindow(hwndParent, GW_HWNDFIRST);

while (hwndChild) {

// save next so we can reparent current child

hwndNext = GetWindow(hwndChild, GW_HWNDNEXT);

// see if this child is contained

GetWindowRect(hwndChild, &rcChild);

if (rcChild.top > rcParent.top && rcChild.left > rcParent.left &&

rcChild.bottom < rcParent.bottom && rcChild.right < rcParent.right) {

// it is, so reparent child

SetParent(hwndChild, hwndParent);

// and move it to the right position

// using SetWindowPos instead of MoveWindow because

// MoveWindow shrinks drop-down panes!!

OffsetRect(&rcChild, -rcParent.left, -rcParent.top);

SetWindowPos(hwndChild, NULL, rcChild.left, rcChild.top, 0, 0,

SWP_NOSIZE | SWP_NOZORDER);

}

// move on

hwndChild = hwndNext;

}

}


ActionSettings Constants

Used with

Action (AwkOne)

Value

Constant

0

acScan

1

acNextLine

2

acClose


AlignSettings Constants

Used with

Align (TabOne)

Align (ElasticOne)

Value

Constant

0

asNone

1

asTop

2

asBottom

3

asLeft

4

asRight

5

asFill


AngleUnitSettings Constants

Used with

AngleUnits (AwkOne)

Value

Constant

0

auRadians

1

auDegrees


AppearanceSettings Constants

Used with

Appearance (ElasticOne)

Value

Constant

0

apFlat

1

ap3D

2

apRaised

3

apInset

4

apRaisedLight

5

apInsetLight

6

apXPThemes


AutoSizeSettings Constants

Used with

AutoSizeChildren (ElasticOne)

Value

Constant

0

azNone

1

azEvenHorz

2

azUnevenHorz

3

azEvenVert

4

azUnevenVert

5

azElastHorz

6

azElastVert

7

azProportional

8

azGrid


AwkErrorSettings Constants

Used with

Error (AwkOne)

Value

Constant

0

aerNone

1

aerCantOpen

2

aerLineTooLong

3

aerFieldTooLong

4

aerBadFieldGet

5

aerBadFieldSet

6

aerSyntax

7

aerBadToken

8

aerBalance

9

aerDivBy0

10

aerDomain

11

aerSingularity

12

aerOverflow

13

aerPartialLoss

14

aerTotalLoss

15

aerUnderflow


CapStyleSettings Constants

Used with

CaptionStyle (ElasticOne)

CaptionStyle (TabOne)

Value

Constant

0

csFlat

1

csRaised

2

csInset

3

csRaisedLight

4

csInsetLight


CaptionPosSettings Constants

Used with

CaptionPos (ElasticOne)

CaptionPos (TabOne)

Value

Constant

0

cpLeftTop

1

cpLeftCenter

2

cpLeftBottom

3

cpCenterTop

4

cpCenterCenter

5

cpCenterBottom

6

cpRightTop

7

cpRightCenter

8

cpRightBottom


CaseSettings Constants

Used with

Case (AwkOne)

Value

Constant

0

csNone

1

csUpper

2

csLower


ElasticStyleSettings Constants

Used with

Style (ElasticOne)

Value

Constant

0

esClassic

1

esFrameTop

2

esFrameBottom


ElasticTemplateSettings Constants

Used with

Template (ElasticOne)

Value

Constant

0

tpNone

1

tpDataEntry

2

tpToolBar

3

tpStatusLine


FileTypeSettings Constants

Used with

FileType (AwkOne)

Value

Constant

0

ftText

1

ftBinary

2

ftUnicode

3

ftANSI


FloodDirSettings Constants

Used with

FloodDirection (ElasticOne)

Value

Constant

0

fdNone

1

fdRight

2

fdLeft

3

fdUp

4

fdDown


FloodStyleSettings Constants

Used with

FloodStyle (ElasticOne)

Value

Constant

0

fsSolid

1

fsBlocks

2

fsPicture


FrameSettings Constants

Used with

Frame (ElasticOne)

Value

Constant

0

fcNone

1

fcWindowed

2

fcNotWindowed

3

fcChildren

4

fcClient

7

fcAll


FrameStyleSettings Constants

Used with

FrameStyle (ElasticOne)

Value

Constant

0

ftNone

1

ftSolid

2

ftRaised

3

ftInset

4

ftFillet

5

ftGroove

6

ftShadow


GridSettings Constants

Value

Constant

0

gsRows

1

gsCols

2

gsRowTop

3

gsColLeft

4

gsRowHeight

5

gsColWidth

6

gsRowFixed

7

gsColFixed

8

gsRowSplitter

9

gsColSplitter

10

gsInsertRow

11

gsInsertCol

12

gsDeleteRow

13

gsDeleteCol


MousePointerSettings Constants

Used with

MousePointer (TabOne)

MousePointer (ElasticOne)

Value

Constant

0

mpDefault

1

mpArrow

2

mpCross

3

mpIBeam

4

mpIcon

5

mpSize

6

mpSizeNESW

7

mpSizeNS

8

mpSizeNWSE

9

mpSizeEW

10

mpUpArrow

11

mpHourglass

12

mpNoDrop

13

mpArrowHourGlass

14

mpArrowQuestion

15

mpSizeAll

99

mpCustom


PicturePosSettings Constants

Used with

PicturePos (ElasticOne)

Value

Constant

0

ppLeftTop

1

ppLeftCenter

2

ppLeftBottom

3

ppCenterTop

4

ppCenterCenter

5

ppCenterBottom

6

ppRightTop

7

ppRightCenter

8

ppRightBottom

9

ppStretch

10

ppTile

11

ppZoom


TabAppearanceSettings Constants

Used with

Appearance (TabOne)

Value

Constant

0

tapFlat

1

tap3D

2

tap3Dlight

3

tapXPThemes


TabPicturePosSettings Constants

Used with

PicturePos (TabOne)

Value

Constant

0

tppAuto

1

tppSide

2

tppTop


TabPositionSettings Constants

Used with

Position (TabOne)

Value

Constant

0

tpTop

1

tpBottom

2

tpLeft

3

tpRight

4

tpRightIn

5

tpLeftHorz

6

tpRightHorz


TabStyleSettings Constants

Used with

Style (TabOne)

Value

Constant

0

tsSlanted

1

tsRounded

2

tsChamfered

3

tsStraight

4

tsCutCorner

5

tsButtons

6

tsToolbar


TabTemplateSettings Constants

Used with

Template (TabOne)

Value

Constant

0

ttpNone

1

ttpRedmond

2

ttpScotts

3

ttpCambridge

4

ttpBerkeley

5

ttpChicago

6

ttpToolbar

7

ttpOutlook

8

ttpInternet


TagPositionSettings Constants

Used with

TagPosition (ElasticOne)

Value

Constant

0

tgLeft

1

tgAbove

2

tgRight

3

tgBelow


TagSplitSettings Constants

Used with

TagSplit (ElasticOne)

Value

Constant

0

tsNone

1

tsPipe

2

tsAlignPipe