How to control the DataWindow column in the PB In the development of the management information application, it is generally encountered a common problem, which is how to control the data columns in the table according to different situations, such as different users of the same DataWindow have different users. Operation (if you can change the data for the data entry person, for the query personnel generally cannot change the data), the following will explain how to use the PB how to modify the column in DataWindow in the DataWindow with a simple wage table. The fundamental columns are as follows:
Code
Name
operating hours
Basic pay
Floating pay
Wage jobs
Intellectual subsidy
Other salary
code
Name
Workdata
Basesa
Movesa
STATIONSA
BT
Othersa
charr
VARCHAR
charr
Decimal
Decimal
Decimal
Decimal
Deciaml
There are two ways in PB to control column properties, one is a static mode, and the other is dynamic. The so-called static mode is to implement by options on the attributes of the column. The so-called dynamic approach is to utilize programming. Introduce: 1. Static method (1) Select a list of MOUSEs in DataWindow, select "Properties", select a label, select the "Edit" tab, and make "Display Only" option to be more (2) or select the "Expression" tab, fill in "1" in "Protect Express"; (3) or select the "Expression" tab, fill in the conditional expression in "Protect Express", such as the working time is dissatisfied The one-year person cannot modify, then "IF (Date (Workdate), Today ()) <= 365, 1, 0)"; (4) In DataWindow, the Tab ORDER value of a column is 0, the column cannot be modified by the focus; (5) Select the ROWS menu in the DataWindow Painter state, then select Update Properties, pop up the Specify Update Properties dialog box, and set the allow updates to empty. Second, the dynamic modification method (1) Set the entire DataWindow to protected: Using the DataWindow Object's ReadOnly property to set the entire DataWindow to a protection. The syntax is: dw_1.object.dataWindow.readOnly = value or dw_1.modify ("dataWindow.readonly {= value}), where: value indicates whether DataWindow is a read-only state, it has two values : Yes and NO. YES means that DataWindow is read-only; NO, the default is No. For example: If you want to set the dataWindow to a protection, you can include the following code in the script of the corresponding event: dw_1.modify ("DataWindow.Readonly = YES) or: dw_1.object.dataWindow.Readonly = yes (2) only Protecting some columns of DataWindow One: Use the list of Protect attribute syntax: dw_1.object.name.protect = integer or dw_1.modify ("ColumnName.Protect {= Integer}"). Parameter Description: Cloumnname: For the column name to be protected; Integer: The column is not protected when the value of the column is 0 or false; the column is protected when the value is 1 or True.
For example, to set the column Name to the protection state, the corresponding code is: dw_1.object.name.protect = 1 or: dw_1.moidfy ("name.protect = 1") method 2: Using the column TabSequence properties, The Taborder of the column can be set as 0 as needed to achieve the purpose of protection. The syntax is dw_1.object.name.tabsequence = number or dw_1.modify ("ColumnName.TabSequence {= Number}) parameter description: ColumnName: The column name to be protected; Number: The Taborder value of the column (0-32000). For example, to set the column Name to a protection state, the corresponding code is: dw_1.object.name.tabsequence = 0 or: dw_1.modify ("name.tabsequence = 0") method 3: Using the modified column's edit attribute DisplayOnly property value. The syntax is: dw_1.object.columnname.edit.displayonly = value or dw_1.modify ("columnname.edit.displayonly {= value}" parameter description: ColumnName: The column name to be protected; Value: Indicates if the column is only DisplayOnly status, there are two values: Yes and NO. YES means that the user is not allowed to enter data (only): NO is the opposite, the default value is NO. For example: If you want to set the column Name to only display, you can include the following code in the script of the corresponding event: dw_1.object.name.edit.displayOnly = YES or: dw_1.modify ("name.edit.displayonly = yes") Although the column is not modified when using this method, the column can be focused, and other methods described above cannot be. Third, the choice to protect some of the above methods will work on all the lines of DataWindow, but if you want to protect some of the rows, you need to use the column protection (take the same above method 2), But this is achieved when it is established. The method is: In the DataWindow Drawboard (Painter), double-click the corresponding column, pop up the Column Object dialog box, select the Expressions page, write IF (conditional expression, 1, 0) in the box after Protect. Flexible use of conditional expressions can get a variety of protection.