A UI synchronization mechanism is needed. RRS feed

  • Question

  •  I'm working on a windows application that looks like Visual Studio .Net 2003.

    I want to allow users to open multiple MDI child forms. Users can also open Properties window or other windows, which look just like those for Properties, solution explorer, and object brower in 2003.

    I need a better mechanism to deal with interactions among the MDI child forms, the main form, and other isolated windows, such as Properties window. 

    Here's one of the cases. Suppose the Properties window contains a TreeView object. Each time a user clicks on a TreeNode, a corresponding TabPage that holds an MDI child form will be brought up if it hasn't been created. Otherwise, the focus should be set on the corresponding TabPage. Similarly, if a user clicks on a TabPage that holds an MDI child form, the focus should set on its corresponding tree node in the Properties window.

    Any thoughts would be appreciated.

    Thursday, February 23, 2006 4:17 PM


All replies

  • I have an idea which may not be good enough.

    Conceptually, I have a main form, several windows like the Properties window in VS.Net 2003, and a bunch of MDI child forms. I divide them into 3 types of UI components.

    1. I want to use the Observer pattern to establish a mechanism that allows one UI component, once its state is changed, to send a message to those that are interested in its state change so that they can also change themselves accordingly via a state object.

    2. Create a State class that holds several common properties of the UI components. Each UI component has an instance of this class.

    So code will look like the following.

    A.UpdateState() --> A.notify() --> for each subscriber, invoke subscriber.update(state)

    Is there a better way to do this? Thanks.

    Friday, February 24, 2006 3:55 PM
  • Rich UIs are non trivial.

    I suggest first understanding the MVP pattern, and the Command Object pattern. After re-defining your problem with these building blocks, I think you will increase your chances of success.

    Friday, February 24, 2006 7:46 PM
  • To continue Udi's reply  - here is a link to an explanation of the MVP pattern

    Also you may want to look at the Composite UI application block  which has both an eventbroker and command constructs


    Saturday, February 25, 2006 7:09 AM