Application of Enter Key in Powerbuilder
As we all know, the Enter key is usually suitable for confirmation, then it is necessary to use the key to enter the key in the application. 1. Enter the application in Window, such as a login window W_Login, when the user enters the username, press the Enter key, you can enter the password input. After the password is input, press the Enter key focus to move to it. Operation, according to the secondary push, then we should use the code to control: First, assume that the W_Login window is: SLE_USERNAME, SLE_PASSWORD, CB_OK and CB_CANCEL and other controls. a. Write the following code in the Modify event of SLE_USERNAME: // Script for user event ue_checkkey, // Which is mapped to pbm_keydown. if keydown (Keyenter!) THEN // Go to SLE_3 IF SLE_2.SETFOCUS () // Enter Pressed End if b. Write the following code in the Modify event in SLE_PASSWORD: // Script for User Event UE_CHECKKEY, / / WHICH IS MAPPED TO PBM_KEYDOWN. IF KeyDown (KeyEnter!) Then // Go To SLE_3 IF CB_ok.setfocus () / / ENTER PRESSED. END IF Note: The default property of the button is not advocated here. Otherwise, press the Enter key to respond to the DEFAULE attribute of the button.
2. Enter key to the application in DataWindow After the user has completed a row of data, if the Enter key is pressed, it is possible to automatically jump to the next line. If the current line is the last line, it will automatically add a line. / ************************************************** *************** User object function: Mainly used for users to switch to the column when using the Enter key when performing data entry. Logic: If the cursor falls in the first column of the current line, then press the back key, the cursor jumps to the next column, and the last column of the line will be reached. When the cursor is in the last column of the current line, press the back to the key to add a number of rows, and the newly added line is used as the current line, and the first list of the current line is the current column. Applicable: Browse the record programming programming in the data sheet: Ocean creation: April 3, 2002 Modified: Version: 1.0 ********************************* *************************************** /
IF this.accepttext () <0 Then return Endness () ..describe ("DataWindow.Column.count")..................... ... INSERTROW (0) this.ScrollTorow (this.Getrow () 1) this.setColumn (1) Return Endness (Handle (this), 256, 9, long (0, 0)) this.setTransObject (SQLCA Of course, the use of the Enter key is very extensive, I hope to have a better way to share, I also hope that everyone will give more valuable advice, thank you!
********************************************************** OCEANAUT 2002-10-22