Exercise for Determining Set subordination: whether CTRL and shift are both pressed

Source: Internet
Author: User
// Set parameters are used for many mouse and keyboard events: Shift: tshiftstate; tshiftstate = set of (ssshift, ssalt, ssctrl, ssleft, ssright, ssmiddle, ssdouble, sstouch, sspen ); {determine whether the ctrl key is pressed: method 1} procedure tform1.formmousemove (Sender: tobject; shift: tshiftstate; X, Y: integer); begin text: = ''; if ssctrl in shift then text: = 'ctrl '; // contains end; {judge whether the ctrl key is pressed: method 2} procedure tform1.formmousemove (Sender: tobject; shift: tshiftstate; x, Y: integer); begin text: = ''; if [ssctrl] = shift then text: = 'ctrl '; // only end; {determine whether CTRL and shift keys are simultaneously pressed: method 1} procedure tform1.formmousemove (Sender: tobject; shift: tshiftstate; X, Y: integer); begin text: = ''; if (ssctrl in shift) and (ssshift in shift) then text: = 'ctrl, shift '; // contains end; {judge whether CTRL and shift keys are simultaneously pressed: method 2} procedure tform1.formmousemove (Sender: tobject; shift: tshiftstate; X, Y: integer); begin text: = ''; if [ssctrl, ssshift] = shift then text: = 'ctrl, shift '; // only end; {determine if both CTRL and shift keys are pressed: method 3} procedure tform1.formmousemove (Sender: tobject; shift: tshiftstate; X, y: integer); begin text: = ''; if [ssctrl, ssshift]
 
  
 

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.