1 / 4

Object passed to event handler

Object passed to event handler. Private: System::Void radio_MouseEnter( Object * sender, EventArg * e) { if ( sender == radioButton1) { // action } if ( sender == radioButton2) { // action } } Register one event handler to more object. Mouse Event Handling.

sidone
Download Presentation

Object passed to event handler

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Object passed to event handler • Private: System::Void radio_MouseEnter( • Object * sender, EventArg * e) • { • if ( sender == radioButton1) { // action } • if ( sender == radioButton2) { // action } • } • Register one event handler to more object

  2. Mouse Event Handling • Mouse events are generated when the mouse interacts with a control • Mouse event information is passed using class MouseEventArgs • The delegate to create the mouse event handlers is MouseEventHandler • Each mouse event handling method must take an object and a MouseEventArgs as arguments

  3. MouseEventArgs • Class MouseEventArgs contains information about the mouse event, such as the x- and y- coordinates of the mouse pointer, the mouse button pressed, the number of clicks • Button - Mouse button that was pressed(left, right, middle or none) • Clicks - the number of times the mouse button(either) was clicked • X – the x-coordinate of the event • Y – the y-coordinate of the event

  4. Mouse events and delegates Handler • Mouse Events(EventHandler) • MouseEnter – Raised if the mouse cursor enters the area of the control • MouseLeave – Raised if the mouse leaves the area of the control • MouseEvents(MouseEventHandler) • MouseDown – raised if the mouse button is pressed • MouseHover – raised if the mouse hovers over the area of the control • MouseMove – raised if the mouse is moved while in the area of the control • MouseUp – raised if the mouse is released when the cursor is over the area of the control

More Related