How do I switch to adjacent cells when I press the left and right cursors in a DW? Original

Source: Internet
Author: User
Tags gettext key return
Cell | original
How do I switch to adjacent cells when I press the left and right cursors in a DW?

Problem Description:

How do I switch to adjacent cells when I press the left and right cursors in a DW?

Solution:

First declare an external function:



Subroutine keybd_event (int bvk,int bscan,ulong dwflags,ulong dwextrainfo) LIBRARY "User32.dll"



First, if you do not want to use the cell in the DW to edit content, as long as one press the left and right key to switch to other cell words can:



The new Ue_key corresponds to the Pbm_dwnkey code as follows:



If key=keyleftarrow! Then

keybd_event (16,0,0,0)//Press the SHIFT key

keybd_event (9, 0,0,0)//Press down tab

keybd_event (9, 0,2,0)//Release tab

keybd_event (16,0,2,0)//Release SHIFT key

Return 1

ElseIf key=keyrightarrow! Then

keybd_event (9, 0,0,0)//Press down tab

keybd_event (9, 0,2,0)//Release tab

Return 1

End If



Second, if you also want to use the cell in the DW to edit content, only in empty or select all when the key to switch to other cells can be:



The new Ue_key corresponds to the Pbm_dwnkey code as follows:



Integer li_len,li_len_selected



Li_len=len (This.gettext ())

Li_len_selected=len (this. SelectedText ())



If not (IsNull (This.gettext ()) or this.gettext () = "" or li_len=li_len_selected) then return



If key=keyleftarrow! Then

keybd_event (16,0,0,0)//Press the SHIFT key

keybd_event (9, 0,0,0)//Press down tab

keybd_event (9, 0,2,0)//Release tab

keybd_event (16,0,2,0)//Release SHIFT key

Return 1

ElseIf key=keyrightarrow! Then

keybd_event (9, 0,0,0)//Press down tab

keybd_event (9, 0,2,0)//Release tab

Return 1

End If




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.