46 Tips and Tricks Of PowerBuilder Datawindow

1. How to make the column of the stored file directory display pictures?

Answer: Select the display as picture property of the corresponding column to be true

2. How to copy the data of the selected row of grid type to the system clipboard?


3: How to change the column position of GRID data window (common for novices)

Answer: Preview first, and then drag in the preview window.

4. How to set the DW background color?

Answer: Change the value of color in DW’s editsource

5. How to change Grid style to free format?

Answer: In DW’s editsource, change processing = 1 to 0

6. To create a new table A but the style is the same as the existing table B style, how to quickly set table A to table B style?

Answer: Copy B table C, change the table name and field name to A table in editsource in DW of C table, then

7. How to realize multi-column header of gird style datawindow?

Answer: add text to the header band, and set the band attribute to the foreground to save, edit source modify the text x and width attribute expression as follows:

8. How to filter records whose display value is specified value in dddw editing style?


9. How to set a column of datawindow to be empty?


10. How to set different color intervals for single and double rows of datawindow?

Answer: Write 

it is the current line The three colors indicate that the expression is as follows:

11. How to get the datawindowo bject with the specified name?


12. How to scale the print size of datawindow?


13. How to filter datawindow based on the filtered data?


14. How to display dynamic time in datawindow?

Answer: Set up a calculation domain, the expression is string (datetime (today (), now ()), ‘yyyy year mm month dd day hh point mm minute ss seconds’), and set the datawindow property

15. How to make the color of the active window of the title bar of the datawindow control with the title bar?

Answer: External function definition:

Clicked event code of datawindow control:

16. How to set the current line indicator of datawindow?

Answer: Create a calculated column in datawindow, the expression is ”, and move the calculated column to the first column of datawindow, in the datawindow control
Write code in the rowfocuschanged event:
SetRowFocusIndicator (hand!) Or setrowfucsindicator (p_1)//p_1 is the picture control name on the window

17. How to open dddw through code?

Answer: Define external function reference declaration

The code is as follows: [constant integer VK_F4 = 115

18. How to print the contents of datawindow to a file?


19. How to set the initial value of dddw?


20. How to display only different data?


21. How to make the datawindow with title bar immovable?

Answer: Write the following code in the custom event ue_nchittest (pbm_nchittest) of datawindow:
Return 1

22. How to create a calculated column based on the column in the Nth column in the N-UP display style?

Answer: If the column has two columns, number and price, and is displayed as two columns, the expression of the cost calculation column in the first column is number * price, and the expression of the cost_1 calculation column in the second column is number [1] * price [ 1]

23. How to clear the items in ddlb or edit.codetable?


24. How to rotate the specified column font 90 degrees?


25. How to get the sql code of datawindow?

Answer: SQL code can be obtained through the following four methods:

27. How to obtain the capacity of the virtual storage occupied by the datawindow object?

Answer: Use datawindow.storage property
Example: In the retrievewind event of the datawindow control, write the following code:

28. How to continuously print two data windows on the same paper?


29. How to set the record number in each group after datawindow grouping?

Answer: Create a calculated column, the expression is

30. How can I edit only the newly added rows in datawindow?

Answer: Write the following expressions in all column’s protect attribute expressions:

31. Except for loops, is there a better way to count the number of selected rows in the data window?

It is generally used to count the number of selected lines in the data window. Is there a better way? In fact, this question is not very useful in application. Discuss it, it is still beneficial to activate your thinking.
Method one:

Method two:

Method three:

32. Q: How to make PB only print the current record, it is a data window made in Free format!


38. How does the field automatically wrap at the same time and automatically height?


39. How to make the dw column immovable and the column width not adjustable?

Answer: Write if row = 0 then return 1 end if in the cilcked event of datawindow

40. The cursor jumps to a row and column in the data window


41 How to make the cursor point to the first line of each page?


42. How does Grid’s window fix the first column?

1. Select the HSplitScroll property of data OBJECT
2. In the constructor event:

3. In the scrollhorizontal event:

43: How to prohibit modification of the column width of the grid data window

Answer: In the Clicked event of the Grid data window, add:

44: grid data window change column width event:

Answer: event: pbm_lbuttondown, pbm_mousemvoe, pbm_lbuttonup
in case:
pbm_lbuttondown: Press the left mouse button in the title bar of the data window (getrow () = 0 and GetObjectAtPointer = your title), and make a note;
pbm_mousemvoe: the mouse moves, and a mark is being recorded;
pbm_lbuttonup: At this time, the left mouse button is up, and then determine whether the position of the last column has changed, and if so, write your script.

45: How to judge whether the content of the data window is modified


46: How to get the controls and lines under the mouse cursor in the data window

Answer: Create a custom event, the event number pbm_dwnmousemove, the event has parameters row, dwo

Get From The Internet

Good Luck!


About The Author

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments