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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:44:14+00:00 2026-05-16T11:44:14+00:00

If you have an application with a GUI totally working on 2D drawing, what

  • 0

If you have an application with a GUI totally working on 2D drawing, what should be the best practice to handle what to draw and where to touch?

An example for better understanding:
I have a game with a map. On this map I can build houses and stuff.
I also have an information bar which can be extended. On the extended bar I draw some information about the game and it also offers the interface to change different values. If a touch occurs, I have to check if the information bar is extended or not, to determine if I want to change something on the map or something on the bar.

That’s done by the State Pattern, but I have some doubt if that’s the right one because I think it can be a bit complex because of possible “sub-states”.

So basically the question: Is the State Pattern (from GoF) the best practice to handle a pure graphical GUI?

  • 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-16T11:44:15+00:00Added an answer on May 16, 2026 at 11:44 am

    The way this typically works is that the UI is a tree of Control objects. Each Control has some bounding box, and potentially a number of child controls which float above it. When a click occurs, the tree is walked from top-down (which means children before parents, and siblings in order). For each control, you see if the point intersects its bounding box. If so, give the control a chance to handle the click (i.e. some virtual OnClick method). If it does, stop processing, that click is done. Otherwise, keep walking until you get to a control that does handle it.

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

Sidebar

Related Questions

My use case is very simple : I have a GUI application, and inside
I have a Windows GUI application that's using the Qt framework (currently version 3.3.5,
I have to build a GUI application on Windows Mobile, and would like it
Say you have an application divided into 3-tiers: GUI, business logic, and data access.
In our application we sometimes have to make minor GUI modifications for different customers:
I have an application which really should be installed, but does work fine when
I have application with two thread. One of them (T1) is main GUI form,
I have a Windows Forms application that I'm working on, but I'm having trouble
I have an application that sends messages to an external web service. I build
We have an application with a good amount of jQuery JSON calls to server

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.