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 8460025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:29:33+00:00 2026-06-10T13:29:33+00:00

Task: make buttons in a program that respond with mouse events(motion,press,release) Approach [1] :

  • 0

Task:

make buttons in a program that respond with mouse events(motion,press,release)

Approach [1] :

Button class have a method that handle events. So it checks if the the event is press or release or motion and call the right method, then I take every handle for each button created and loop it as long as the programe is running.

Approach [2] :

I already have a Mouse class handling all mouse inputs. So the second approach would work on mouse motion. I mean I won’t be looping a handler all the time, but when a mouse motion is detected I check if the motion was on a button (this check will be performed in the Mouse class that handles mouse inputs). If it was on a button then execute that button method that correspond to the event type.

So I was wondering which approach would be better?!

  • 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-06-10T13:29:35+00:00Added an answer on June 10, 2026 at 1:29 pm

    A button may not be exclusively tied to your mouse input, but can also be triggered by your keyboard inputs (for example).

    Even if this program isn’t using keyboard inputs for buttons, it may be the case for your next program. If you go for Approach [1], you will be able to re-use your code in a wide range of situations.

    On top of that, with Approach [2] your Mouse code will be filled with Buttons stuff which can pollute it.

    That’s why I suggest you to go for the Approach [1]

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

Sidebar

Related Questions

Simple task: I would like to make a program (parent.exe). There are three buttons.
Say you have a menu item and a button that do the same task.
I have a task to make a survey to be displayed in SharePoint 2007
I just wanna ask how can I make a form with two buttons that
I could like to have a button that does double duty as a progress
I have a button that when the user clicks it, it must go to
I have a widget that contains 4 buttons to show 4 stock prices, each
I have such task - to create control that union two controls (DataGrid from
I was given a small task to simply make a button's text toggle On
I want to make Task in Google Calendar using Google Calendar API : c#.

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.