YOU CAN CODE!

 

With The Case Of UCanCode.net  Release The Power OF  Visual C++ !   Home Products | Purchase Support | Downloads  
Download Evaluation
Pricing & Purchase?
E-XD++Visual C++/ MFC Products
Overview
Features Tour 
Electronic Form Solution
Visualization & HMI Solution
Power system HMI Solution
CAD Drawing and Printing Solution

Bar code labeling Solution
Workflow Solution

Coal industry HMI Solution
Instrumentation Gauge Solution

Report Printing Solution
Graphical modeling Solution
GIS mapping solution

Visio graphics solution
Industrial control SCADA &HMI Solution
BPM business process Solution

Industrial monitoring Solution
Flowchart and diagramming Solution
Organization Diagram Solution

Graphic editor Source Code
UML drawing editor Source Code
Map Diagramming Solution

Architectural Graphic Drawing Solution
Request Evaluation
Purchase
VX++ Cross-Platform C/C++
Overview
Download
Purchase
ActiveX COM Products
Overview
Download
Purchase
Technical Support
  General Q & A
Discussion Board
Contact Us

Links

Get Ready to Unleash the Power of UCanCode .NET


[ First | Prev | Next | Last ]


Properties

A Property is a piece of information that is associated with an object. Storing and retrieving all of the properties belonging to an object through a single interface provides a convenient and generic way to deal with any property. The ability to discover and access an object's properties at runtime makes it possible to write generic services for accessing properties. For example, the same serialization code is used to store and retrieve the properties of all components. There is no need to change the serialization code when new properties are added. A generic property browser is also possible given a consistent interface to an object's properties. Examples include FillStyle, LineStyle, FontStyle, ShadowStyle, and EventStyle.


Property classes

The CFOBaseProperties class is the base class for property values. Classes derived from CFOBaseProperties represent either specific data types or nested properties. The CFOBaseProperties class ties a property value.

The CFODrawShape class does provide methods for accessing property value objects directly, however it is usually more convenient to get and set property values through the property container interfaces. It is sometimes useful to manipulate nested or compound properties directly.

Property ID

Each property is assigned a unique identifier. Property ID Start at 5000. Property ID from 5100 and up can be used by customer applications to define custom properties.

A component may have more than one property of the same type, as long as their ID are unique. For example, it is possible for a component to have two font properties.

Property ID are used to lookup properties within a list. This allows you to identify the property as being of a certain type, such as a font property. By default, the ID is set to reflect the different property classes. For example, the default component property object has an ID of FO_DEFAULT_PROP_ID. However, you can change this ID to identify a specific property.

How to set or get a property for a component

The following code segment shows how to set a property for a component:

1.How to set a property for a component?

The following code segment shows how to set a property for component:

CFOCompProperties pProp = pComp->GetDefaultProperty();
if(pProp != NULL)

{

    pProp->SetObjectCaption("New Caption");

    pProp->SetObjectName("Name");

}

2.How to set a property for a datamodel.

The following code segment shows how to get a property by an ID:

CFOPageProperties pProp = pModal->GetDefaultProperty();
if(pProp != NULL)

{

    pProp->SetBkColor(RGB(255,0,0));

    pProp->SetMinButton(FALSE);

}

3.How to add a new property object for a component?

Do the following:

Step 1:Open XD++ Library from windows startup menu and run XD++ Library add-in.

Step 2:Select "Create New Property Source..." from menu Properties ,then input a name of the new class.For example:CMyCustomProperties

Step 3:Copy files MyCustomProperties.h and MyCustomProperties.cpp from "C:\temp\" to current project

Step 4:Open file MyCustomProperties.h and insert following codes on the top

Then modify the construct function, as following:

Step 5:Open Component class of the property you want to add. For example: If we need add this class to class CMyCorsssLineComponent, we must open file MyCorsssLineComponent.cpp first and insert following codes:

Then add codes as below:

So we finish add property to components. You can add new property to class Data Model by same means.

4.How to visit the custom property of a component?

You can use the following code to visit your custom property:

Add following function:

5.How to remove a custom property from a component?

You can use the following code to remove your custom property:

Add following function:

RemoveProperty(ID_MY_PROP_ID)

6.How to remove all properties from a component?

You can use the following code to remove your custom property:

Add following function:

ClearAllProp()

7.How to visit the properties list of a component?

You can use the following code to remove your custom property:

Add following function:

CFOBasePropertiesList *GetPropList();

9.How to create a copy of property?

You can use the following code to remove your custom property:

Add following function:

CMyCustomProperties* pCopy = (CMyCustomProperties *)pYourNeedCopyProp->Copy();

 

Details:

Property

Description

CFOCompProperties Component default properties.
CFOFormProperties Form default properties.
CFOPageProperties Multi page Model's page default properties.

[ First | Prev | Next | Last ]

Ask any questions by MSN: ucancode@hotmail.com Yahoo: ucan_code@yahoo.com


 

Copyright ?1998-2024 UCanCode.Net Software , all rights reserved.
Other product and company names herein may be the trademarks of their respective owners.

Please direct your questions or comments to webmaster@ucancode.net