How to switch to the adjacent cell when pressing the left and right cursor in DW? (Original)

xiaoxiao2021-03-06  38

How to switch to the adjacent cell when pressing the left and right cursor in DW?

Problem Description:

How to switch to the adjacent cell when pressing the left and right cursor in DW?

solution:

First, declare the external function:

Subroutine KeyBD_EVENT (int BVK, Int Bscan, Ulong Dwflags, Ulong Dwextrainfo) library "user32.dll"

First, if you don't want to use the left and right keys to edit content in DW, you can switch to other cells as long as one button is pressed.

New UE_KEY corresponds to PBM_DWNKEY, the code is as follows:

IF key = keyftarrow! then

KeyBD_Event (16, 0, 0) // Press the Shift button

KeyBD_Event (9, 0, 0) // Press Tab

KeyBD_Event (9, 0, 2, 0) // Release the Tab button

KeyBD_EVENT (16, 0, 2, 0) // Unnumped SHIFT

Return 1

Elseif key = keyrightarrow! Then

KeyBD_Event (9, 0, 0) // Press Tab

KeyBD_Event (9, 0, 2, 0) // Release the Tab button

Return 1

END IF

Second, if you want to use the left and right keys to edit content in the cell of DW, you can only switch to other cells when you empty or completely elect, you can:

New UE_KEY corresponds to PBM_DWNKEY, the code is as follows:

Integer li_len, li_len_selected

li_len = len (this.getText ())

li_len_selected = le (this.selectedText ())

IF not (isnull (this.gettext ()) or this.gettext () = "" or li_len = li_len_selected) THEN RTURN

IF key = keyftarrow! then

KeyBD_Event (16, 0, 0) // Press the Shift button

KeyBD_Event (9, 0, 0) // Press Tab

KeyBD_Event (9, 0, 2, 0) // Release the Tab button

KeyBD_EVENT (16, 0, 2, 0) // Unnumped SHIFT

Return 1

Elseif key = keyrightarrow! Then

KeyBD_Event (9, 0, 0) // Press Tab

KeyBD_Event (9, 0, 2, 0) // Release the Tab button

Return 1

END IF

转载请注明原文地址:https://www.9cbs.com/read-65028.html

New Post(0)