Navi. Component. DataWindow development manual (including examples)

Source: Internet
Author: User

1 Overview 1.1 features

The PowerBuilder development tool of Sybase was quite elegant before VS was successful. Microsoft had to work with it to learn its Db Technology and achieve SQLServer database. The advantage of PB development tools is its powerful data window function. The use of this technology makes development of management software, especially database management software very simple. compared with the development of the same software in NET, the development cycle can be shortened to 1/3, but with the decline of Sybase, the technical updates are not timely, so that the PB development tools are gradually forgotten in the long river of time, rarely mentioned and remembered. however, we can still use the powerful functions of the data window in the NET environment.

This component uses the powerful functions of the data window to solve our common business scenarios. At the same time, it encapsulates a layer for more convenient use.

After sorting and analysis, the data window used in the NET environment includes the following functions:

1.1.1 Grid Control

Displays data in batches. It supports multiple data loading methods, bottom aggregate bands, multiple choice of rows, and other practical functions. Similar to the following environment controls

Webform

The GridView control. The server only contains data for loading.

Winform

DataGridView Control

1.1.2 print Template

Print data directly. In the Webform environment, you do not have to consider the topic object location, style, and other headaches. we can set the style of a complex report, including the field location and size, in the data window. The job done on the WebForm side is to load data.

1.1.3 document editing template

The document is where data editing is provided. You need to adjust the layout and size of the control based on the user experience. If each adjustment requires the developer to intervene, the modification time of user requirements will be affected. using the data window, we can modify it in another design environment. After modification, it can be directly delivered to the customer, without having to modify it in the VS environment.

1.1.4 search Template

Generally, some common search conditions are provided on the page for displaying batch data to help users find the data they need most. when collecting search conditions, we may retrieve the values of each search control and splice them into the Where conditions required by SQL statements.

Using the data window, you can add or delete a Search topic at any time. The search value can be spliced together.

1.2 application scenarios

Sybase's PowerBuilder development tool is mainly used to develop Winform software, which is rarely involved. However, this does not indicate that the data window cannot be used by the Webform program as an ActiveX control, it can still be used in IE browser. currently, the following application scenarios are supported:

Scenario name

Description

Webform Application

Used as an ActiveX Control

Winform Application

Used as a UserControl Control

1.3 target groups

The production environment of this control can be different from. NET environment, you only need to install PowerBuilder or run the data window designer to complete the data window creation process. as a direct service provider for program users, software implementers can complete simple production after 1-2 days of training. the release and deployment of programs are also simple and convenient. therefore, in addition to software developers, implementers are also a group-oriented control.

Target group

Description

Software developers

Call controls

Implementer

Create a data window for the control to call

1.4 Runtime Environment

Net Class Library only requires 2.0 and above.

It is also the same as the general control. You only need to call the DLL file. the DLL environment contains two parts. part 1 is required by the PowerBuilder environment. Because the data window control is a control in the PowerBuilder development tool, it must contain this part of DLL; Part 2 is required by the data window itself, if the data window itself needs to be used in the NET environment, the data window control in the PowerBuilder environment needs to be encapsulated by Sybase and used as a control that can be parsed by NET, this includes part 1 of the required DLL files. the detailed DLL file is as follows:

DLL file type

DLL file list

PowerBuilder application

DataWindow Control

Buffer name

Description (official, English)

Primary

The data in the primary buffer, meaning data that has not been deleted or filtered out. (Default value when argument is optional .)

Delete

Data in the delete buffer, meaning data that has been deleted from the DataWindow but has not been committed to the database.

Filter

Data in the filter buffer, meaning data that has been removed from view.

L RowStatus

Enumeration object, that is, the row state of the data window, which is equivalent to the DataRowState enumeration object in NET. The attribute values include the following:

Enumeration object

Description

Modified

Modified row

New

New row

NewAndModified

Rows in the new and modified status

NotModified

No operation row status

L ItemStatus

Enumeration object, which is consistent with the RowStatus function. It is a column State. That is, whether a column in a row in the data window is modified. NET does not find a similar enumeration object. The attribute values include the following:

Enumeration object

Description

Modified

Modified Columns

NotModified

No column status

L Processing

This is the property of a data window. This property indicates that the data window loaded by the control is of the type, and the control itself does not know how the data to be loaded is displayed, it may be batch data (Grid type), some are single data (Form type), so this attribute is set for differentiation. attribute values include:

Type

Description

Form

Single Data Display

Grid

Batch Data Display, similar to grid controls

Label

Tags are similar to the product tags in supermarkets.

Graph

Charts and controls can also directly load charts

Crosstab

Cross report. You can set row-column crossover for a table in the database.

Composite

Composite reports. This type of data window can be used as a sub-table by placing data windows of other types at the same time. For example, you can place Grid and Form at the same time.

OLE

You can place data directly to the OLE control. The OLE control must be supported by PowerBuilder.

RichText

Data can be directly stored in the RichText control.

TreeView

This type of data display is a very popular display method recently. that is, the Parent and Child tables in the grid control. in a simple understanding, parent and child tables are also hierarchical. Compared with the tree, each level may need to display more than one node,

L ItemEditStyle

The editing type of the object in the data window. This indicates that the object is a text box, line, or image box. Its Attribute values include the following:

Enumeration object

Description

Text

Label, which can be understood as the Label in NET

Column

Db column object, which can be understood as TextBox in NET

Line

Straight Line

Bitmap

Image box

Compute

Calculation Column

L Item

This is a keyword and will be more appropriate. in the encapsulated class library, you will see many GetItemXX and SetItemXX methods. the Item here can be understood as a project, a subitem, that is, an object in the data window, which may be a direct Item, or a text box or an image box.

L Sub

This is a keyword and only applies to data windows of complex types. the data window of the composite type can be placed in other data windows at the same time, so the data window is represented by Sub. this is to be different from the Item keyword because they have different meanings.

2 API documentation

Refer to the Navi. Component. DataWindow. chm File.

3. Business scenarios

Using this control can easily help us complete many common business scenarios. Here, we provide code examples and instructions for common business scenarios.

3.1 Data Loading

It is to fill the data of Db or other external files into the data window control. This type of database provides six methods for data loading. there are petabytes of traditional methods and NET-based methods. You need to determine which method to use based on different business scenarios.

Before loading data, we must first set two properties for the control. that is, the name and object of the carrier file required for the data it loads. it can be understood as the name of the visualization window carrying data and the name of its DLL file. load the file as follows, as shown in-1.

Keywords

Description

Data Source

SqlServer service name

Database

Database Name

User id

Logon user ID

PWD

Logon User Password

L method 2.-3

Keywords

Description

Server

SqlServer service name

Database

Database Name

User id

Logon user ID

PWD

Logon User Password

L method 3.-4

Method Type

Method Name

Description

Value

GetItemDeciaml

Obtains the column value of the Decimal type.

GetItemDouble

Obtains the value of a Double column.

GetItemDateTime

Obtain the column value of the DateTime type.

GetItemString

Obtains the value of a String column.

GetItemObject

Obtains the column value, regardless of the column type.

GetItemObjectText

Obtain the Column Display value. The drop-down menu is dedicated to editing columns.

GetItemExpression

Obtain the calculated field expression, which is dedicated to the calculated Field

Assignment

SetItemNull

Set the column value to Null

SetItemObject

Set column value, Object Type

SetItemExpression

Set column expression, only for calculated fields

3.3 document page cascade operations

Cascade operations mean that the value of a control changes according to the value of another control. Generally, the most common scenario is the linkage effect between provinces and cities. this control is used to simulate this business scenario. The scenario is described as follows:

The two columns are province and city. They are all drop-down menu editing types. the province is filled with Beijing and Tianjin. The data in the city is based on Beijing or Tianjin, and the following districts and counties are loaded. for example, Beijing, dongsi district, Tianjin, Hongqiao district. interface-8. select the province drop-down menu, and the city data will be linked

Name

Description

D_example_composite_head_bl

Composite data window header file

D_example_composite_body_bl

Composite data window table object

D_example_composite_foot_bl

Composite data window table tail File

The data loading method is also relatively simple, as shown in-23, as shown in the data loading drop-down menu,-23

Name

Description

Navi. Example. DataWindow

Entire solution name

Navi. Example. DataWindow. WinForm

Example files of the WinForm and WebMVC types

Navi. Example. DataWindow. WebHtml

WebForm sample file

Personal Edition

Http://pan.baidu.com/s/1pJqduEv

 

5FAQ

1. In what development environment can controls be used?

A: The control can be used in both WebForm and WinForm. in the WinForm control, it is used as a custom control. In the WebForm control, it is used as an ActiveX control and can only be used in browsers with IE as the kernel.

2. What is the version of the control development tool based on PowerBuilder?

A: The control is based on PowerBuild11.5.

3. Does the row number in the batch data window start from 0 or 1?

A: It is different from that of NET from 1. This is because Sybase's PowerBuilder development tool is earlier than NET.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.