How to control the modification properties of the DataWindow column in the PB

zhaozj2021-02-16  56

In the preparation of the management information application system, there is generally a common problem, which is how to get the data columns in the table according to different situations, such as different operations with different users of the same dataWindow (such as the data entry personnel can change the data) And for query people generally cannot change data), the following will be used as an example of a simple wage list.

How to control the modification method of the column in DataWindow.

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 Protect some columns of DataWindow

Method 1: Use the list of Protect attribute syntax as: 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.

(1) Only the newly inserted row is allowed to be in a DataWindow, sometimes there is a need: existing data can only be browsed does not allow modifications, only the newly entered data is allowed to modify, at which time the expression is: IF (IsRowneW (), 0, 1), or IF (not isRownew (), 1, 0) (2) protection of a column should be performed in accordance with the data of other columns, only in employee salary, only 5 years When you enter the intellectual subsidy (BT), you can enter: if (integer (for "), 1,4) - Integer (MID (MID (Workdata) 1, 4))> 5, 0, 1) (3) The row to be protected can only be determined when executed, and changing, for example, in employee wage management, it is assumed that the salary is modified only the salary input is changing. And in general, only the condition is required to determine the condition when executed, you need to specify a parameter (such as Flag) that retrieve data when establishing DataWindow, and then entered in the box that can be modified (user_name) Is a column in the DataWindow representing the name of the input): if (user_name = flag, 0, 1) pay attention to the actual type of parameters when practical.   (4) Increasing the above method in the table, the above method is basically required to protect the row to be protected, and when these lines are not regular, it can be specifically adding a marker column in the corresponding table (list name " For FLAG), the value is 1 and 0, then directly input the FLAG expression in the box after other columns. If the line of the line is in the row, the column of the row is in the protection state. For the modification of the flag column value, you can modify or work flex in the program based on some situation. Related resources: with sound access new year fireworks animation effects - html-code

转载请注明原文地址:https://www.9cbs.com/read-17407.html

New Post(0)