[Pb] locking a column with Pb when the data window is horizontally rolled

Source: Internet
Author: User
1. "locking a column with Pb when the data window is horizontally rolled"
--------------------------------------------------------------------------------
Zhang Hongwei, Research Office of data knowledge engineering, computer department, Chongqing University (400044), question proposal
The article "locking a column with petabytes during horizontal scrolling of data windows" of H23, 39th tells you how to implement data windows.
A method used to lock a column during horizontal scrolling of the port has good practical effects, but this method also has some disadvantages. The
1. The columns locked by this method are pre-determined by the program, that is, the "static" State, which cannot be changed when the program is running. This way
When you need to lock different columns at different times, it cannot be implemented. Second, this method is implemented by a program, including
Complex work. Through careful experiments, I found two more simple implementation methods, you can
With simple programming, you can lock certain columns dynamically.
II. Implementation Method
Assume that the data window for displaying data is a dw-1.
Method 1: create data in datawindow painter of the PowerBuilder Integration Environment
Window control dw-1, move the mouse over the control, right-click, a menu appears on the screen, select menu item
Style, and then select hscroll bar, vscroll bar, and heat transport scrolling from the cascade menu.
Complete required functions.
When running the application, there is a small gap at the far left of the horizontal scroll bar of the data window dw-1, move the mouse to this place, hold down the left button
No, there will be a vertical line in the data window to split the data window horizontally, and then drag the mouse to move the vertical line to
The data window is divided into two seemingly independent and parallel data display areas.
The data display area is the same as that in the original data window. When you click the horizontal scroll bar of one area
The data display of the domain remains unchanged. When you click the vertical scroll bar of any area, the display of the two areas is synchronized. Use this method
Users can place the columns (one or more columns) to be locked in one region, while the other region performs horizontal scrolling and runs
You can adjust the columns to be locked at will.
Method 2: the above effects can be achieved through simple programming, and the effects can be dynamically disabled or allowed. In the Poe
In rbuilder, the data window has a property of "hsplitscroll", which is used to determine whether to split a data window into two for display.
Data. This function is allowed when it is true. If it is false, this function is disabled. Therefore, when you want to allow this lock
When you can, you only need to write a dw-1.HsplitScroll = true; to disable this function, you only need to write a sentence D-1.
It is easy to implement because it is set to false.
Iii. Summary
The above two methods overcome the two disadvantages of the original text, and can dynamically lock the corresponding columns as needed, which is very flexible and simple.
Single, user operations are more convenient. 2. Lock a column to implement the same style as in Excel
In Excel, when there are many columns, when we move the current row to the last item, the first column will not be seen, so we can lock the value of the first column or the first row, so that, no matter how many rows or columns are there, we can see them to ensure data accuracy. in this way, we can easily achieve this in Pb. the Code is as follows:
// The locked column ID. The data window is dw_master.
Dw_master.hsplitscroll = true
Dw_master.object.data1_1_horizontalscrollsplit = dw_master.object.id.width
Dw_master.object.data1_1_horizontalscrollposition2 = dw_master.object.id.Width 3. In the constructor event of the data window, write:
Dw_1.object.data1_1_horizontalscrollsplit = integer (dw_1.describe ("#1. width "))

In the scrollhorizontal event of the data window, write:
Int I
If pane = 1 then
I = integer (this. OBJECT. datawindow. horizontalscrollposition2)
If I <1 or isnull (I) then return
If scrollpos> 0 then
This. OBJECT. datawindow. horizontalScrollPosition = 0
End if
Else
I = integer (this. Object. DataWindow. HorizontalScrollSplit)
If I <1 or isnull (I) then return
If I> scrollpos then
This. OBJECT. datawindow. horizontalScrollPosition2 = I
End if
End if

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.