PowerBuilder Curriculum Part 2
IV. Data window
1. Function
function | parameter | description |
dw_1.insertrow(row) | row sets the insertion position | insert blank line |
When successful, return the row number inserted successfully, and return -1 if failed | ||
insertrow(0) means to insert a row in the last row | ||
dw_1.deleterow(row) | row the row number to delete | delete row |
Returns 1 on success, -1 on failure | ||
deleterow(0) means delete the current row | ||
dw_1.retrieve() | dw_1.retrieve(parameter 1, parameter 2, parameter 3…) | retrieve data |
dw_1.update (accept,resetflag) | accept: the default is true, call before execution | modify or update operation |
resetflag is true by default, and the data window automatically resets the update flag. | ||
Returns 1 on success, -1 on failure | ||
dw_1.setsort(format) | format: A ascending order, D descending order | set sort |
Returns 1 on success, -1 on failure | ||
dw_1.sort() | Returns 1 on success, -1 on failure | According to the current data window |
sorting rules for sorting | ||
sequence | ||
dw_1.setfilter(format) | format: is a string, can be defined using field name or field number | Set filter conditions for the data window |
Returns 1 on success, -1 on failure | ||
Example 1: dw_1.setfilter(“age > 25 and age < 45”) | ||
Example 2: dw_1.setfilter(“#3>25”) | ||
Example 3: dw_1.setfilter(“”) | ||
dw_1filter() | datawindow | |
filter | ||
dw_1.reset() | Returns 1 on success, -1 on failure | Clear all data windows |
have data | ||
dw_1.scroll(number) | number: the number of rows to scroll | Set the number of rows to scroll |
Scroll down when the parameter is positive and scroll up when it is negative | ||
Successfully returns the data line number displayed in the first line of the control, and returns -1 when it fails | ||
dw_1.scrolltorow(row) | row specifies the row number | scroll to the specified line |
Returns 1 on success, -1 on failure | ||
dw_1.scrollpriorpage() | scroll to previous page | |
dw_1.ScrollNextPage() | scroll to next page | |
dw_1.scrollpriorrow() | scroll to previous line | |
dw_1.scrollnextrow() | scroll to next line | |
dw_1.getrow() | Returns 0 when there is no current line, returns -1 on failure, and returns the current line number on success | Get the line number of the current line |
dw_1.getcolumn() | Returns 0 when there is no current column, returns -1 on failure, and returns the current column if successful | Get the column number of the current column |
column number | ||
dw_1.setrow(row) | row specifies the row number | set current line |
Returns 1 on success, -1 on failure | ||
dw_1.setcolumn (column) | coumn column number or column name | set current column |
Returns 1 on success, -1 on failure | ||
Example: Set the current column as column 5 | ||
dw_1.setcolumn(5) | ||
Example: Set the current column as the age column | ||
dw_1.setcolumn(“age”) |
function | parameter | description |
dw_1.setrowfocusindicator (f,x,y) | f Visual icon to indicate the current line | set to indicate the current row visualization icon |
x x coordinates | ||
y y coordinate | ||
Returns 1 on success, -1 on failure | ||
Example: Setting the hand icon | ||
dw_1.setrowfocusindicator(Hand!) | ||
Example 2: Set the picture control p_arrow as the indicator icon | ||
dw_1.setrowfocusindicator(p_arrow) | ||
dw_1.rowcount() | Returns 0 when there is no data, returns -1 on failure | Get data window head office number |
dw_1.modifiedcount() | Returns the number of data rows that have been modified but not updated, and returns 0 if there is no data, and fails Return -1 on defeat | Get the data window is Modified, but not updated The number of rows of data. (Not included including the newly inserted row) |
dw_1.deletedcount() | Returns 0 when there is no data, returns -1 on failure | To get the data window do marked for deletion, did not The number of update operations Number of data rows |
dw_1.filteredcount() | Returns 0 when there is no data, returns -1 on failure | Get the filtered number Number of data rows |
dw_1.accepttext() | Will still be editing the number data, sent to the data window port controls | |
dw_1.gettext | Get the edit control in the text | |
dw_1.settext(text) | Returns 1 on success, -1 on failure | Set the edit control’s text |
dw_1.getitemdate (row,column, dwbuffer,originalvalue) | row specifies the row number of the data row | Get the date of the specified field period variable |
column: the specified data column | ||
dwbuffer specifies the buffer for reading data | ||
When originalvalue is true, return the value of the original buffer, which is | ||
Returns the current value when false | ||
Example: Take the date variable of the first_day field in the third row of the data window dw_1 | ||
dw_1.getitemdate (3,”first_day”) | ||
dw_1.getitemdatetime() | row specifies the row number of the data row | Get the date of the specified field time variable |
column: the specified data column | ||
dwbuffer specifies the buffer for reading data | ||
When originalvalue is true, return the value of the original buffer, which is | ||
Returns the current value when false | ||
dw_1.getitemtime() | row specifies the row number of the data row | When getting the specified field Intervariate |
column: the specified data column | ||
dwbuffer specifies the buffer for reading data | ||
When originalvalue is true, return the value of the original buffer, which is | ||
Returns the current value when false | ||
dw_1.getitemstring() | row specifies the row number of the data row | Get the word of the specified field |
column: the specified data column | ||
dwbuffer specifies the buffer for reading data | ||
When originalvalue is true, return the value of the original buffer, which is | ||
Returns the current value when false |
function | parameter | Description |
dw_1.getitemnumber() | row specifies the row number of the data row | Get the number of the specified field value variable |
column: the specified data column | ||
dwbuffer specifies the buffer for reading data | ||
When originalvalue is true, return the value of the original buffer, which is | ||
Returns the current value when false | ||
dw_1.getitemdecimal() | row specifies the row number of the data row | Get the small of the specified field numeric variable |
column: the specified data column | ||
dwbuffer specifies the buffer for reading data | ||
When originalvalue is true, return the value of the original buffer, which is | ||
Returns the current value when false | ||
dw_1.sharedata (dwsecondary) | Returns 1 on success, -1 on failure | data window control data share, keep in sync new |
dw_1.sharedataoff() | Returns 1 on success, -1 on failure | Close between data windows shared relationship |
dw_1.print() | canceldialog: The default is true to display a non-modal cancel print dialog frame | print data window |
Returns 1 on success, -1 on failure | ||
dw_1.printcancel() | Returns 1 on success, -1 on failure | Cancel the opening of the data window print |
dw_1.getitemstatus (row,colum,dwbuffer) | row specifies the row number of the data | Get the status of the specified field state |
The data column specified by column | ||
dwbuffer specifies the buffer for reading data, the default is the main buffer, | ||
Returns a dwitemstatus enumeration variable | ||
Example: Take the work field in the fifth line of the data window dw_1 in the filter buffer state | ||
l_status | ||
l_status = dw_1.getitemstatus (5,’work’,filter!) | ||
dw_1.setitemstatus (row,colum, dwbuffer,status) | row specifies the row number of the data | Set the status of the specified field state |
The data column specified by column | ||
dwbuffer specifies the buffer for reading data, the default is the main buffer, | ||
Returns a dwitemstatus enumeration variable | ||
status enumeration variable | ||
Example: Set the party field in line 5 of the data window dw_1 in the main buffer Status is notmodified | ||
l_status | ||
l_status= | ||
dw_1.setitemstatus (5,’salary’,primary!,notmodified!) | ||
dw_1.setitem (row,column,value) | the row specified by row | Assign a value to the specified field |
column specified column | ||
the content of the value assignment | ||
dw_1.getvalidate (column) | column defines the field (serial number or field name) of the inspection rule. Return Validity check rules for specified fields | Get some current fields Validity testing rules for |
dw_1.setvalidate (column,rule) | column defines the field of the inspection rule (serial number or field name) rule new validity check rule | Set current some fields Validity testing rules for |
Returns 1 on success, -1 on failure |
2. crud
(1), put the edited data into the main buffer
1 |
dw_1.accepttext() |
(2) Add data
1 |
dw_1.insertrow(0) |
(3), delete data
1 2 3 4 5 6 7 8 9 10 |
//1, delete the first row dw_1. DeleteRow(1) //2. Keep the first row of the data window, and delete other rows in a loop For ll_i = dw_1.RowCount() To 1 Step - 1 If ll_i = 1 Then dw_1.Object.fieldname[1] = Value Else dw_1. DeleteRow(ll_i) End If Next |
(4), update data
1 2 3 4 5 6 7 8 9 |
String ls_err If dw_1. Update() = 1 Then Commit Using sqlca; MessageBox('prompt','update successful') Else ls_err = sqlca.SQLErrText Rollback Using sqlca; MessageBox('prompt','update failed' + ls_err) End If |
(5), retrieve data
1. To set the external transaction object of the data window control, connect, commit, disconnect must be specified
1 2 |
dw_1.settransobject(sqlca) dw_1. retrieve() |
2. It is used to set the value of the internal affairs of the data window control. Automatically connect, commit, disconnect
1 2 |
dw_1.SetTrans(sqlca) dw_1.Retrieve() |
3. Set the field to read-only
Method 1. Set tab order to 0
Method 2, dw_1.modify(“cname.tabsequence = 0”)
Method 3, dw_1.modify( “meno.edit.displayonly=yes”)
Method 4, dw_1.modify(“code_course.protect= 1”)
4. Switch data window
1 |
dw_1.DataObject = "Data Window Name" |
5. Hide the data window refresh process
1 2 |
dw_1.SetRedraw(False) //do not refresh dw_1.SetRedraw(True) //Refresh |
6. Data window sharing
1 |
dw_2.ShareData(dw_1) |
7. Pass the in parameter in the data window SQL
1 2 3 4 5 6 7 8 |
//When passing to the data window, the content in in must be an array type For i = 1 To dw_1.RowCount() If dw_list.Object.selectflag[i] = 1 Then ls_in[i] = String(dw_1. Object. test[i]) ll_num++ End If Next dw_1. Retrieve(ls_in) |
8. Get the sql of the current data window
1 |
dw_1.GetSQLSelect() |
9. Set the sql of the current data window
1 |
dw_1.SetSQLSelect(sql) |
10. Call the sub data window
1 2 3 4 5 6 7 8 |
Integer rtncode datawindowchild dwc_child rtncode = dw_1.GetChild("main window field", dwc_child) If rtncode = 1 Then MessageBox('',dwc_child.GetItemString(1,'child window field')) Else MessageBox('Prompt', 'The child data window has not been obtained!') End If |
11. Determine whether the data window has been modified
1 2 3 4 5 6 7 |
//Judge whether the data window is modified, it is recommended to write in the closequery event dw_1. AcceptText() If dw_1.ModifiedCount() + dw_1.DeletedCount() > 0 Then MessageBox('Prompt', 'The data window has been modified, do you want to save it?') Else MessageBox('Prompt', 'The data window has not been modified, exit normally') End If |
12. Reset the data window
1 |
dw_1.Reset() |
13. Data window regrouping
1 2 3 |
//Regrouping, after we process filtering and sorting, if it is a grouping window, it may break the grouping rules //So we need to regroup, regrouping is usually after filter() or sort() dw_1. GroupCalc() |
14. Get the state of the data window
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
//(optional state: datamodified! new! newmodified! notmodified!) //When the retrieve() function is used to read data from the database for the first time, all records and fields in the data window buffer belong to NotModified! status. //After the data was modified at that time, the modified record status flag and field status flag will be changed to DataModified! //When adding a piece of data, the field status flag of the added data is NotModified!, and the record status flag is New!. //When we fill in the data in the added field, the field status flag is DataModified! The record status flag is NewModified! If dw_1.GetItemStatus(1,dw_1.DeletedCount(),primary!) = datamodified! Then MessageBox('1: Modified data', 'datamodified!') ElseIf dw_1.GetItemStatus(1,dw_1.DeletedCount(),primary!) = new! Then MessageBox('2: data has been added','new!') ElseIf dw_1.GetItemStatus(1,dw_1.DeletedCount(),primary!) = newmodified! Then MessageBox('3: data has been filled', 'newmodified!') ElseIf dw_1.GetItemStatus(1,dw_1.DeletedCount(),primary!) = NotModified! Then MessageBox('4: Unmodified data', 'notmodified!') End If |
15. Set the status of the data window
1 2 |
//(optional state: datamodified! new! newmodified! notmodified!) dw_1.SetItemStatus(1,dw_1.DeletedCount(),primary!,notmodified!) |
16. Find the first selected row in the data window
1 2 |
//dw_1.getselectedrow('Specify which row to start querying from, and set it to 0 if starting to query from row 1') MessageBox('the first selected row', dw_1.GetSelectedRow(0)) |
17. Data window search (find)
1 2 |
//dw_1.find(search condition expression, start line, end line), if the expression is true, then return the line number that meets the condition dw_1.Find('id=8',1,10) |
18. Data window filter
(1), column name filter
1 2 |
dw_1.SetFilter("isnull(column name)") dw_1. Filter() |
(2), conditional filter
1 2 |
dw_1.SetFilter("column name='" + column Value + "'") dw_1. Filter() |
(3), clear filter
1 2 3 4 5 6 |
//Method 1: dw_1. SetFilter('') dw_1. Filter() //Method 2: w_1.SetFilter('1=1') |
(4), sql statement filtering
1 |
sql = 'select * from table name where isnull(field name, ''null'') = ''null'' '; |
19. Data window pagination
- Add a calculated column
This calculated column must be placed in the detail segment
Input in expression: ceiling(getrow()/500) <–500 here can also be replaced by a global function
This allows the user to arbitrarily set how many rows per page. - To define a group, select the menu rows->create group…
Group by calculated column field, and check box–>new page on group break must be selected. - Make this calculated column invisible.
Then add the following buttons to complete the pagination function
(1), home page
1 2 |
dw_1.ScrollToRow(0) dw_1.SetRow(0) |
(2), previous page
1 |
dw_1.ScrollPriorPage() |
(3), next page
1 |
dw_1.ScrollNextPage() |
(4), last page
1 2 |
dw_1.ScrollToRow(dw_1.RowCount()) dw_1.SetRow(dw_1.RowCount()) |
20. Data window sorting
(1), positive sequence
1 2 |
dw_1.SetSort("column name a") dw_1. Sort() |
(2) Arrange in reverse order
1 2 |
dw_1.SetSort("column name d") dw_1. Sort() |
(3), Double click to sort
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
String ls_old_sort, ls_column Char lc_sort If Right(dwo.Name,2) = '_t' Then ls_column = Left(dwo.Name, Len(String(dwo.Name)) - 2) ls_old_sort = This.Describe("datawindow.table.sort") If ls_column = Left(ls_old_sort, Len(ls_old_sort) - 2) Then lc_sort = Right(ls_old_sort, 1) If lc_sort = 'a' Then lc_sort = 'd' Else lc_sort = 'a' End If This.SetSort(ls_column + " " + lc_sort) Else This.SetSort(ls_column + " a") End If This.Sort() End If |
21. Data window focus
1 2 3 |
dw_1.SetFocus() dw_1.SetRow("data row number") dw_1.SetColumn("field name") |
22. line
(1), row processing
1 2 3 4 5 6 |
dw_1.RowCount() //Get the total row dw_1.GetRow() //Get the current row dw_1.SetRow(1) //Set the current row dw_1.ScrollToRow() //Scroll to the target row dw_1.SelectRow(1, True) //Make the first row selected dw_1.iselected(1) //Check if the first row is selected |
(2), highlighting
1. In the click event of the data window, write the following code
1 2 3 4 5 |
If row > 0 Then This.SetRow(row) This.SelectRow(0,False) This.SelectRow(row,True) End If |
2. In the rowfocuschanged event of the data window, write the following code
1 2 3 4 5 |
If currentrow > 0 Then This.ScrollToRow(currentrow) This.SelectRow(0, False) This.SelectRow(currentrow,True) End If |
(3), interlaced color change
- Open the data window
- Right click detail
- Find the small icon on the right side of the color property on the right
- Enter the following code in the expression
1 |
If ( Mod( GetRow() , 2) = 1 , RGB(255,255,255) , RGB(235,255,235) ) |
(4), self-increasing row
- Add a calculated column, page n of n
- select getrow()
(5), set the number of print lines per page
- Add a calculated column page n of n and enter the formula: ceiling(getrow()/20)
- Select the menu rows->create group to create a group, and select the formula column page_1 just created
- After creating the group, select the attribute on the right, and tick the new page on group break
- If the last page needs to be filled with blank lines
1 2 3 4 5 6 7 8 9 10 |
Long ll_pagerow = 6 //number of print lines per page Long ll_count, ll_row ll_count = dw_1. Retrieve() // Get the total number of rows in the existing report ll_count = ll_pagerow - Mod(ll_count, ll_pagerow) If ll_count < ll_pagerow Then For ll_row = 1 To ll_count dw_print.InsertRow(0) //Fill a blank line Next End If |
(6), mobile line
1 2 3 4 5 6 7 8 |
// move row //(primary! Main buffer delete! Delete buffer filter! Filter buffer) //dw_name.rowsmove (start line, end line, buffer, another window name to move to, which line to insert before, which buffer to insert district) //rowsmove can also move rows in different buffers of the same data window //For example: move lines from the delete buffer to the main buffer to realize the recovery function: dw_1.DeleteRow(1) //Delete row 1 dw_1.RowsMove(1,dw_1.DeletedCount(),Delete!,dw_1,1,primary!) //Restore row 1 |
(7), copy row
1 2 3 4 5 6 |
//copy line (primary! main buffer delete! delete buffer filter! filter buffer) //dw_name.rowscopy(start line, end line, buffer, another window name to copy to, which line to insert before, which buffer to insert district) //rowscopy( )--basic usage is similar to moving rows dw_1.DeleteRow(1) //Delete row 1 dw_1.RowsCopy(1,dw_1.DeletedCount(),Delete!,dw_1,1,primary!) //copy row 1 |
23. Columns
(1), get the column name of the data window
1 2 3 4 |
Integer li_index For li_index = 1 To Integer(dw_1.Object.datawindow.column.count) MessageBox(String(li_index),dw_1.Describe("#" + String(li_index) + ".name")) Next |
(2), get the dbname corresponding to the field
1 2 3 4 |
Integer li_index For li_index = 1 To Integer(dw_1.Object.datawindow.column.count) MessageBox(String(li_index),dw_1.Describe("#" + String(li_index) + ".dbname")) Next |
(3), copy column
1 |
dw_1.Object.field Name.primary = dw_1.Object.field Name.primary |
(4), get display column
1 |
Describe('DataWindow.Table.GridColumns') |
24. Data window multi-selection box
(1), in the sql of the data window, add a multi-select box field
1 |
'ls_checkbox' = '0', |
(2) Set the edit property of the field to checkbox and check 3d look
(3), set (data value for on = 1), set (data value for off = 0)
(4) Write in the click event of the dw_1 data window
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
If dwo.Name = "ls_checkbox_t" Then If dw_1.RowCount() = 0 Then Else If dw_1.Object.ls_checkbox[1] = "1" Then For row = 1 To dw_1.RowCount() dw_1.Object.ls_checkbox[row] = "0" Next Else For row = 1 To dw_1.RowCount() dw_1.Object.ls_checkbox[row] = "1" Next End If End If End If |
(5) How to get the value?
1 2 3 4 5 6 |
Long cbx_i If dw_1.RowCount() = 0 Then Return 0 For cbx_i = 1 To dw_1.RowCount() If dw_1.GetItemString(cbx_i, "ls_checkbox") = '1' Then End If Next |
25. datastore
1 2 3 4 5 6 7 8 9 10 |
datastore lds_test lds_test = Create datastore //Associate the data window object with the instantiated datastore variable lds_test.DataObject = 'd_main' / / Specify the Transaction Object For the Data Storage Object lds_test.SetTransObject(sqlca) //The next step is the same as operating the normal data window (example) lds_test.InsertRow(0) lds_test.Object.Title[1] = 'I am the title of the test' MessageBox('', String(lds_test.Object.Title[1])) |
26. Dynamic data window
(1), parameter transmission and reception
1 2 3 4 5 6 7 8 9 10 11 |
//1, assignment dw.SetItem(row, 'column name', Value) dw.Object.column_name[row_number] = Value //2, value dw_1.Object.field Name (Number Of rows) //direct value dw_1.Object.Title Name.Text //title text box dw_1.GetItemString (row Number, column Name) //string dw_1.GetItemNumber(row Number, column Name) //value dw_1.GetItemDate(Number Of rows, column Name) //date dw_1.GetItemDateTime (Number Of rows, column Name) //date time dw_1.GetItemDecimal(Number Of rows, column Name) //decimal |
(2), describe (get various attributes in the data window)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
MessageBox('Get field name',dw_1.Describe("#1.name")) //title MessageBox('Get field type',dw_1.Describe("title.ColType")) //char(10) MessageBox('Get field background color', dw_1.Describe("title.background.color")) //536870912 MessageBox('Get field background mode', dw_1.Describe("title.background.mode")) //1 MessageBox('Get whether the field allows automatic horizontal scrolling', dw_1.Describe("title.edit.Autohscroll")) //yes MessageBox('Get whether the field is the primary key', dw_1.Describe("title.key")) //no MessageBox('Get the data protection in the field', dw_1.Describe("title.protect")) //0 MessageBox('Get the sliding property of the field (whether to slide to the left when the left side is blank move)', dw_1.Describe("title.SlideLeft")) //no MessageBox('Get the sliding property of the field (whether to slide up when there is a blank above move)', dw_1.Describe("title.slideup")) //no MessageBox('Get the TabOrder value of the field', dw_1.Describe("title.tabsequence")) //10 MessageBox('Get field can be modified', dw_1.Describe("title.update")) //no MessageBox('Get field verification rules', dw_1.Describe("title.validation")) //? MessageBox('Get the expression of the field', dw_1.Describe("title.expression")) MessageBox('Get the properties of the displayed value',dw_1.Describe("Evaluate('LookupDisplay(sex)',1)")) //The latter 1 is the line number |
(3), modify (modify various attributes in the data window)
1 2 3 4 5 6 |
MessageBox('modify field background mode', dw_1.Modify("title.background.mode='1'")) MessageBox('modify field background color', dw_1.Modify("title.background.color = '0'")) MessageBox('Modify search rules', dw_1.Modify("title.criteria.dialog = yes sex.criteria.override_edit=yes")) MessageBox('modify the field display format to date format', dw_1.Modify("title.format = 'yyyy-mm-dd'")) MessageBox('Modify the field as the primary key', dw_1.Modify("title.key = yes")) MessageBox('Modify the protection attribute of the field', dw_1.Modify("title.protect ='1~tif(isrownew(),0,1)'")) |
(4), use syntaxfromsql to dynamically create data windows
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
//Connect to the default transaction sqlca sqlca.DBMS = "mss microsoft sql server" sqlca.Database = "Database Name" sqlca.LogPass = 'login password' sqlca.ServerName = "server name or ip" sqlca.LogID = "Server login user name" sqlca.AutoCommit = False sqlca.DBParm = "" Connect Using sqlca; String dw_sql, dw_style String dw_syntax, dw_syntax_error, dw_create_error //Set the data window sql dw_sql = "select * from table name" //Set the data window style dw_style = "style(type=grid)" //Construct sql data source dw_syntax = sqlca.SyntaxFromSQL(dw_sql, dw_style, dw_syntax_error) //Judge whether there is an error in the sql data source If Len(dw_syntax_error) > 0 Then MessageBox("Prompt", "Error constructing sql data source: " + dw_syntax_error) Return End If //Create dw_1 data window through sql data source dw_1. Create(dw_syntax, dw_create_error) //Judge whether there is an error in the creation of the dw_1 data window If Len(dw_create_error) > 0 Then MessageBox("Prompt", "Error creating data window: " + dw_create_error) Return End If //retrieve data dw_1.SetTransObject(sqlca) dw_1. Retrieve() |
27. Import and export
(1), data window import
1 2 3 4 5 6 |
//dw_1.importfile(imported file type, file name, file start line, file end line, file start column, file End column, Start column Of Data window ) //Because the exported data windows have titles, we start importing from line 2 dw_1.ImportFile(Text!,'1.txt',2,10,1,10,1) //import txt file dw_1.ImportFile(excel!,'1.xls',2,10,1,10,1) //import xls file dw_1.ImportFile(excel!,'1.xlsx',2,10,1,10,1) //import xlsl file dw_1.ImportFile(csv!,'1.csv',2,10,1,10,1) //import csv file |
(2), data window export
1 2 3 4 5 |
//dw_name.saveas (name can contain path, save as type, whether to display column title) dw_1.SaveAs("1.txt",Text!,True) //save as txt file dw_1.SaveAs("1.xls",excel!,True) //save as xls file dw_1.SaveAs("1.xlsx",excel!,True) //save as xlsl file dw_1.SaveAs("1.csv",csv!,True) //save as csv file |
28. Data window shortcut keys
1 2 3 4 5 |
//1, create a new event //Event Name KeyDown //Event ID pbm_dwnkey (you can Choose This one, Other parameters will be Set By itself) //2. In this event, write the following code If Key = KeyEnter! Then Send(Handle(This),256,9,0) |
29. How to set the current row indicator icon of datawindow?
1 2 3 4 5 |
//Create a calculated column in datawindow, the expression is '', and move the calculated column as the first column of datawindow, in //datawindow control //Write code in the rowfocuschanged event: SetRowFocusIndicator(hand!) //Little finger style setrowfucsindicator(p_1) //custom picture style |
30. How to change the Grid style to free format?
Change the 1 of processing=1 to 0 in the editsource of DW
31. How to automatically wrap the data beyond the content of the column?
- Find the column you want to set
- Select the Position tab, and select the Autosize Height checkbox.
- Click on the Detail Band (that is, the long gray band with Detail), and select the Autosize Height multi-selection box on the right
PowerBuilder Manual Book Part 3Â ClickHere
Good Luck!