Exam 13: Handling Events

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Given a GUI Control , what objects and delegates are provided to handle mouse events such as clicking, pointing, and dragging?

Free
(Essay)
4.8/5
(29)
Correct Answer:
Verified

Mouse events include all the actions a user takes with a mouse, including clicking, pointing, and dragging. Mouse events can be handled for any Control through an object of the class MouseEventArgs . The delegate used to create mouse event handlers is MouseEventHandler . Every mouse event-handling method must have two parameters: an object representing the sender, and an object representing the event. Depending on the event, the type of the second parameter is EventArgs or MouseEventArgs .

The code generated in Design mode in the IDE is not meant to be altered by typing. You should modify Control properties through the Properties window in the IDE.

Free
(True/False)
4.7/5
(37)
Correct Answer:
Verified

True

When an event occurs, any delegate that a client has given or passed to the event is invoked.

Free
(True/False)
4.9/5
(42)
Correct Answer:
Verified

True

Assume you declare three delegates named delegate1 , delegate2 , and delegate3 . You then assign a reference to method M1() to delegate1 , and a reference to method M2() to delegate2 . How do you make delegate3 into a composed delegate that executes both M1() and M2() ? What are the rules concerning return type and parameter list for composed delegates?

(Essay)
4.8/5
(45)

The first parameter of an event-handler method is an object named ____________________; it is a reference to the object that generated the event.

(Short Answer)
4.8/5
(39)

What are the default conventions for naming event handlers?

(Essay)
4.9/5
(38)

When you define your own event-handler delegate, what arguments are required? Provide an example of a delegate declaration.

(Essay)
4.9/5
(34)
Match each item with a statement below:
Used to notify an object's client of a change that has occurred in the object
composed delegate
A type of delegate that lets you invoke multiple method calls using a single statement
event
A delegate used to create mouse event handlers
event sender
Correct Answer:
Verified
Premises:
Responses:
Used to notify an object's client of a change that has occurred in the object
composed delegate
A type of delegate that lets you invoke multiple method calls using a single statement
event
A delegate used to create mouse event handlers
event sender
The control that generates an event
event receiver
The technique of packaging an object's attributes and methods into a cohesive unit that can then be used as an undivided entity
Empty
Shown in the Properties window of the IDE, and looks like a lightning bolt
MouseEventHandler
Generated when a Button object is clicked
encapsulation
Also known as an event-handler method
Click event
Represents an event that contains no event data
Events icon
(Matching)
4.9/5
(49)

What are the two actions that can be taken on an event field?

(Essay)
4.8/5
(38)

An event-handler method is also known as a(n) ____.

(Multiple Choice)
4.8/5
(45)

When you open the ____ file in an IDE, you can examine all the code generated by the Windows Form Designer for an application that creates a Form .

(Multiple Choice)
4.8/5
(39)

Programmers say that a button click ____ an event.

(Multiple Choice)
4.8/5
(39)

Given the delegate declaration:   delegate void GreetingDelegate(string s); What do you know about any method that is represented by this delegate? In general, what can you tell about a method if you know it is encapsulated by a particular delegate?

(Essay)
5.0/5
(37)

The ____ class static field named Empty represents an event that contains no event data.

(Multiple Choice)
4.7/5
(30)

Keyboard events are also known as ____.

(Multiple Choice)
5.0/5
(32)

To declare your own event, you use a ____.

(Multiple Choice)
4.7/5
(36)

The ____ event occurs when the mouse cursor leaves the Control 's boundaries.

(Multiple Choice)
4.9/5
(33)

____ occur when a user presses and releases keyboard keys.

(Multiple Choice)
4.8/5
(32)

A(n) ____ provides a way for the clients of a class to dictate methods that should execute when an event occurs.

(Multiple Choice)
4.9/5
(33)

Events must be declared as private .

(True/False)
4.9/5
(43)
Showing 1 - 20 of 41
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)