The composite color of the PowerBuilder data window displays

xiaoxiao2021-03-06  79

1. Foreword Data Window in PowerBuilder can be said to be the core of PB, so that Sybase is even patented for it. All operations for data in the database are almost all through the DataWindow object, and the quality creation of data window objects directly affects the application itself. For many new contact PowerBuilder, the difference between the DataWindow control and the DataWindow object is often confused. In fact, the DataWindow control is a control similar to the Checkbox, CommandButton control. The DataWindow object is an object that is created in the PBL library with the discipline. The DataWindow control is like a container in the control relative to the DataWindow object. Some data windows that are often used in actual use are often used. Now let's talk about the compiration of colors in the data window displays this common skill. 2. Function Description Data Window often returns a lot of records after retrieve, and the data in these records is complex, usually caused by visual inconvenience. Therefore, if the line is distinguished between the line and the rows, for example, the background color of the first line record is light white, the background color of the second line record is light gray, the third line is light white, the fourth line It is also light gray ... It is pushed by secondary, which can greatly facilitate the user, and make your application have a lot of color. At the same time, when the user clicks on the current line, the color will become a light yellow, which will like anyone. 3. Implementation Method To achieve the above effect, we should first know that these performance forms should be reflected in the data window object. Obviously, all data in the data window is listed in the detail, so it will affect its display effect as long as a column is set in the detail belt. The specific implementation is as follows: Open the data window, select all columns (Column). Turn to the Font tab in the Properties window, click on a small button next to the Background Color property. See Figure 7.1.

Figure 7.1 Take a red tap button

Enter in the Expression Expression column (see Figure 7.2):

IF (currentrow () = getRow (), RGB (255, 240, 194), IF (GetRow (), 2) = 1, & RGB (255, 254, 249), RGB (247, 247, 239)))))))

Figure 7.2 Input expression

Note: RGB (255, 240, 194) is light yellow, RGB (255, 254, 249) is light white, and RGB (247, 247, 239) is pale yellow. 4. Effect show Back to the preview window to see, the effect is quite good! See Figure 7.3.

} Figure 7.3 Color effect

5. Related Functions Description Currentrow () and getRow () functions are data window information functions. 1. Currentrow () function Description: Get the line number of the row of the input focus. Syntax: currentrow () return value: long. When the function is executed, return the line number of the current line, and return 0 without the current line. 2. GetRow () function description: Returns the current line line line in the corresponding band of the data window. Syntax: getRow () return value: long. When the function performs success, return the line number of the current row in the corresponding belt, if there is no data in the data window, return to -1 when an error occurs.

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

New Post(0)