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

  • Home
  • SEARCH
  • 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 6764145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:33:34+00:00 2026-05-26T14:33:34+00:00

I have a toolbar with a combobox. When the item changes on the combobox,

  • 0

I have a toolbar with a combobox. When the item changes on the combobox, it makes a call to the draw panel (which the toolbar has a reference to) to tell the draw panel to change the shape type. Now, the the draw panel has a popup menu that changes the shape type aswell. Therefore, when the popup menu changes the shape type, the combobox needs to be notified as well. The only way I can think of it is for the draw panel to have a reference to the toolbar, but I do not like the idea of a circular dependency. Is there a better way?

Thanks

  • 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-26T14:33:34+00:00Added an answer on May 26, 2026 at 2:33 pm

    According to the model-view-controller pattern which is commonly considered the best approach for GUI coding, you’d have a model, a view and a controller. In this case, the underlying model would be some value corresponding to the state of the combo box and what the popup menu shows. The views are the combo box and popup menu. They are both also controllers since they can alter the model’s state.

    So the “clean” way to implement this is to hold the state somewhere separately and have a list of components there that should be notified when the model state changes. On a state change, the list should be iterated and the components in it should have their view updated. The combo box and menu entry should be registered as such “listeners”.

    Now, I said that was the “clean” way, but for a simple setup as yours you don’t necessarily have to implement it this way. It can complicate things and make the code less legible. On the other hand, doing it the MVC way will make future changes easier, like adding new views/controllers. Doing that without MVC would result in more and more components requiring knowledge of each other’s existence, while now it’d all be cleanly encapsulated in a model.

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

Sidebar

Related Questions

I have a ToolBar WPF control which has a Stackpanel docked to right. I
I have a toolbar image which has a tab on top of it as
I have created an application that has a toolbar, menubar and content area. I
I have a Java project with a toolbar, and the toolbar has icons on
I have a toolbar, in which is placed a UIBarButtonItem. The selector is targeted
I have a ComboBox with fairly complex template for individual items, which includes two
I have toolbar with buttons and a menu. The menu item looks odd between
I have a toolbar aligned at the bottom and a WebView above it, which
I have a toolbar control in my application. Delete an item from dataform from
I have a toolbar, which is next to a slider (screenshot: http://i54.tinypic.com/w2n6ag.jpg ) and

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.