TMouse (C++)
Description
This example uses two check boxes, three edit boxes, and a timer component on a form. When the application starts, the check boxes get checked by the application, depending on whether a mouse is detected and a wheel button is available. The first edit box displays the number of lines that are scrolled each time the wheel button is rotated. The other two edit boxes display the position of the mouse cursor at each millisecond, using the timer component.
Code
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
CheckBox1->Checked = Mouse->MousePresent;
CheckBox2->Checked = Mouse->WheelPresent;
Edit1->Text = IntToStr(Mouse->WheelScrollLines);
Edit2->Text = IntToStr((int)Mouse->CursorPos.x);
Edit3->Text = IntToStr((int)Mouse->CursorPos.y);
}
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
Edit2->Text = IntToStr((int)Mouse->CursorPos.x);
Edit3->Text = IntToStr((int)Mouse->CursorPos.y);
}
Uses
- Vcl.Controls.TMouse ( fr | de | ja )
- Vcl.Controls.TMouse.MousePresent ( fr | de | ja )
- Vcl.Controls.TMouse.WheelPresent ( fr | de | ja )
- Vcl.Controls.TMouse.WheelScrollLines ( fr | de | ja )
- Vcl.Controls.TMouse.CursorPos ( fr | de | ja )