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

I have banking gui application that I am currently working on and there seems
I have a GUI application whose main part is a QPlainTextEdit . It is
I have complex GUI application written in Python and wxPython. I want it to
I have a GUI application which works with point cloud data and a quadtree
I have a wxPython GUI application that contains 13 pairs of StaticText controls that
I have an application written in pure/basic Java without GUI. I have three classes
Very simple Qt GUI application: On the scene I have multiple circles implemented as
I have an application which displays properties dialogs for various GUI-accessible objects. Because there
I'm a new bit in Qt... I have a Qt GUI application (written by
I have a GUI C++ application (Visual Studio 2008) that needs to be converted

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.