Freetutes.com

VB6 beginners tutorial - Learn VB6

Advanced VB6 tutorial - Learn Advanced VB6

VB .NET - Learn Visual Basic .NET

Systems Analysis - System analysis and Design tutorial for Software Engineering


You are here: Visual Basic > Advanced VB6 tutorial > Chapter 13

Create and Enable Property Pages for ActiveX Controls

Property Pages provide an alternative to the Properties Window for a developer who wants to edit property values at design time. As a developer you're already familiar with the property pages of standard and custom VB controls.

You should consider using Property Pages with your ActiveX control when

  • your control has numerous custom properties that can be easily organized into categories.

  • your control uses complex custom properties that don't represent just a single value.

  • many of your custom properties are more easily edited with non-text controls, such as drop-down lists, option buttons, or check boxes.

You implement Property Pages as special modules of your ActiveX control project (.pag files).

A control can have many Property Pages (as do the DBGrid, ToolBar, and StatusBar controls for example) depending on the complexity and logical groupings of its properties.

To program Property Pages, you need to know how to program with:

  • The PropertyPage designer:- This is a Form-like interface similar to the UserControl designer or the designer for regular VB Forms. You place intrinsic VB controls on its surface to provide the developer with an interface for editing property values.

  • SelectedControls collection:- This collection holds the controls that the developer has currently selected.

  • SelectionChanged event:- When a developer displays the Property Page or changes selected control(s), you use the property values of the first selected control to initialize controls on the Property Page.

  • EditProperties event:- Use its PropertyName argument to determine which complex control a user is trying to edit.

  • Changed property:- This property flags whether changes have been made to properties with the Property Page.

  • ApplyChanges event:- This event fires when developers save changes they have made to properties.

After you've programmed the behavior of your Property Pages, you'll need to take one or more of the following actions to cause your control to display Property Pages correctly:

  • Connect custom controls to your Property Page.

  • Connect individual complex properties to your Property Page.

  • Connect some properties to standard VB Property Pages.

We discuss the features of the above two lists in the following sections.

  1. Creating the PropertyPage Object's Visual Interface
  2. Determining Which Controls Are Selected for Editing With the SelectedControls Collection
  3. Using the SelectionChanged Event to Detect When the Developer Begins to Edit Properties
  4. Flagging Property Changes With the Changed Property
  5. Saving Property Changes With the ApplyChanges Event
  6. Connecting a Custom Control to a Property Page
  7. Connecting a Single Complex Property to a Property Page
  8. Detecting Which Complex Property Is Being Edited With the EditProperty Event
  9. Connecting a Property to a Standard VB Property Page


  

<< Previous | Contents | Next >>

Home | About Us | Privacy Policy | Contact Us

Copyright © Freetutes.com | All Rights Reserved