When the user enters the data, a large amount of duplicate data is often encountered, i.e., when the next record is entered, its value is the same as the value of the previous record. If the editor's automatic entry of the same value, it will greatly increase the entry speed.
The specific implementation method is as follows:
First, the main function used in the program
1, FileOpen () function: Open the specified file with the specified read and write mode, and return the handle of the file.
2, FileWrite () function: read data from the specified file.
3, FileClose () function: Turn off the file that is previously opened with a fileOpen () function.
4, setText () function: Get the value in the editing box above the current row and columns.
5, GetText () function: Replace the text in the editing box control of the current row of the DataWindow control or DataStore object.
6, send () function: Send a specified message to the window and perform the corresponding event handler immediately.
7, Describe () function: Returns the attribute value of the DataWindow object or other object in the DataStore object.
The above functions can be found in the function book on PB, which is no longer detailed, but should pay attention to the use of the two functions.
Second, the specific implementation method
1. Establish the name of the Window specific control as shown in Figure 1.
2. Define instance variable arrays String is_value [] and integer if_file (handle to open the file)
String is_columncount
3. Write the following code in the open event of Window
INT i
If_file = fileopen ("sys.ini", linemode !, read !, lockread!)
IS_COLUMNCOUNT = DW_INPUT.DESCRIBE ("DataWindow.Column.count") / / Total number of data for DataWindow objects
For i = 1 to integer (is_columncount)
FileRead (if_file, is_value [i])
NEXT
FILECLOSE (if_file)
DW_INPUT.SCROLLTOROW (dw_input.rowcount ()) // Set the cursor to the last row
DW_INPUT.SETCOLUMN (Integer (is_columncount))
Write the following code in the Window's CLOSE event
INT i
IF_FILE = FileOpen ("Sys.ini", LINEMODE!, WRITE!, LOCKWRITE!, Replace!)
For i = 1 to integer (is_columncount)
FileWrite (if_file, is_value [i])
NEXT
FILECLOSE (if_file)
4, give DataWindow Control Customize a Enter key event:
Event name: UE_KEYENTER EVENT ID: PBM_DWNPROCESSENTER
5, write the following code in the UE_KEYENTER event of DataWindow Control
IS_VALUE [this.getColumn ()] = this.getText ()
Send (Handle (THIS), 256, 9, Long (0, 0))
this.Settext (is_value [this.getcolumn ()])])
Return 1
Write the following code in the constructor event of DataWindow Control
this.settransObject (SQLCA)
this.Retrieve ()
6, customize a carriage return to CB_APpend
Event name: UE_KEYDOWN EVENT ID: PBM_KEYDOWN
Write the following code in CB_APpend's Clicked event
DW_INPUT.SETFOCUS () dw_input.scrollTorow (dw_input.insertrow (0)) // Add a vacation record and point to new records
DW_INPUT.SETCOLUMN (1) // Point to the apartment list
DW_INPUT.SETTEXT (IS_VALUE [1])
Write the following code in the UE_PBM_KEYDOWN event in CB_APPEND
IF keydown (Keyenter!) THEN
THIS.TRIGGEREVENT (Clicked!)
END IF
※ Pay attention to the order of Tab ORDER of each control.
The above step is just a simple implementation fast entry, and more detailed encoding should be made if the specific situation is encountered.