Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6694293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:05:06+00:00 2026-05-26T06:05:06+00:00

Was just messing around looking at the XNA documentation for the Game class and

  • 0

Was just messing around looking at the XNA documentation for the Game class and noticed there is a Deactivated event and an OnDeactived virtual method one can override.

Both creating an event handler for the Deactivated event and overriding the OnDeactived virtual method allows the client to handle the game losing focus.

I was wondering which approach should be used generally to handle the game losing focus. Creating an event handler or overriding the virtual method? Are there any differences between each approach?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:05:07+00:00Added an answer on May 26, 2026 at 6:05 am

    There are two obvious differences:

    • You can only override OnDeactivated within a class derived from the one declaring it – mere “other” code can only use the event
    • Within OnDeactived, it’s up to you to decide whether or not to call base.OnDeactivated – you could effectively suppress the event, or change the parameters; invoke it before or after your own code, etc.

    If you’re already deriving from the class, either way would work – personally I’d probably use the event more often than not, unless I wanted to take any other sort of action that could only be performed by overriding. Aside from anything else, that makes the code more portable if you want to move it anywhere else. Then again, I’m generally not a fan of inheritance anyway, so I’m biased 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am just messing around trying to make a game right now, but I
I've just started messing around with Windows Phone development, and I'm looking for some
Im just messing around with Ruby on Rails and HTML. This question isn't about
I was just messing around to answer someone's question here on Stack Overflow, when
Just by messing around a little it seems that the video stream is not
I'm just messing around with Visual Basic in Visual Studio 2010. Anyone know how
I've just been messing around with threads in Java to get my head around
I just reinstalled IIS7.5 after a lot of ugly messing around. I admittedly had
I'm a newbie and when messing around with creating database applications I always just
I'm just looking around for starting learning NDK, with one particular project in mind:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.