BCB key event to determine the shift, ALT, CTRL state

Source: Internet
Author: User

The BCB key event determines the state of shift, ALT, and CTRL:

Similar to this in this event

void __fastcall Tform1::keydown (tobject *sender, WORD &key,tshiftstate Shift)
{
  if (key==vk_delete)
   {
        ((tcxtextedit*) Sender)->top=-111;
        ((tcxtextedit*) Sender)->left=-111;
   }
   if (Key==vk_left&&shift.contains (Ssctrl))
   {
        int left= ((tcxtextedit*) Sender)->left-5;
        if (left<0) left=0;
        ((tcxtextedit*) Sender)->left=left;
   }
}
Shift is a Tshiftstate collection, the values and meanings of the elements in the collection are described in the following table

element values and their meanings:
Ssshift: "Shift" key is pressed;
Ssalt: "Alt" key is pressed;
Ssctrl: "Ctrl" key is pressed;
Ssleft: The left mouse button is pressed;
Ssright: The right mouse button is pressed;
Ssmiddle: The middle mouse button is pressed;
Ssdouble: Both left and right mouse are pressed at the same time.

View whether an element is in the collection, using method contains ().
BOOL __fastcall Contains (const T) const;
Returns True if the collection contains an element t, otherwise false is returned.


Collect keyboard Virtual key values

Backspace->8 tab->9return->13 pause->19 capslock->20 esc->27 Space->32 pageup->33 pagedown->34

end->35 home->36 leftarrow->37 uparrow->38 rightarrow->39 downarrow->40 printscrn->44 insert->45 delete->46

0->48         1->49             &NBSP;&NBSP;2->50   ;            3->51               4->52   &N Bsp             5->53               6->54 &NB Sp          7->55             8->56       &N Bsp         9->57

a->65    b->66          c->67           &NBSP;D-&G t;68             e->69            f->70   &NBS P        g->71         h->72         &NBSP;&NBSP;I-&G t;73            j->74         k->75       &NBS P  l->76               m->77

n->78 o->79 p->80 q->81 r->82 s->83 t->84 u->85 v->86 w->87 x->88 y->89 z->90

lwin->91 rwin->92 popmenu->93

numpad0->96 numpad1->97 numpad2->98 numpad3->99 numpad4->100 numpad5->101 NumPad6->102 Nu mpad7->103 numpad8->104 numpad9->105
numpad*->106 numpad+->107 numpad-->109 numpad.->110 numpad/ ->111

f1->112 f2->113 f3->114 f4->115 f5->116 f6->117 f7->118 f8-> 119

f9->120 f10->121 f11->122 f12->123 f13->124 f14->125 f15->126 F16- >127

f17->128 f18->129 f19->130 f20->131 f21->132 f22->133 f23->134 F24 ->135

numlock->144 scrolllock->145

;->186,->188->190/->191 '->192 [->219 \->220]->221 '->222


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.