CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2006
    Posts
    99

    Unhappy how to manage popup windows?

    Hello,

    I’m working on a project that has many pop up windows. They are not organized properly and things are getting messy. I’m wondering if there are any common practice or design patterns for solving this problem.

    I’d like to give you some concrete examples:

    1. my program connects to two different tcp ports on the same ip. cutting off any of them, the user will be notified with a MessageBox. But in case of unplugging network cable, both message box will show, which is unnecessary.

    2. we provide a shortcut key to display a setting dialog. However the program can also show the same dialog when certain event happens. If the user opens the setting dialog already, those event will still trigger a second setting dialog.

    3. when application settings are not correct, user will disconnect from the server and an error dialog will show up and terminate the program. But if the user knows about the situation and has opened the setting dialog to fix the issue, the error dialog will terminate his work. which is bad.

    I don’t know how to deal with this window management problem in a complex software project. Of course, I can solve the issue case by case by checking if certain dialog is shown before displaying another dialog. But there are too many cases, when the code base gets big, this is not practical.

    there must be some generic solution I think.
    Last edited by billconan; March 24th, 2014 at 11:02 AM.

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: how to manage popup windows?

    Without knowing more about the OS and class libraries, a specific answer isn't possible, but in general, you'd want to create the different dialogs and show them and hide them as necessary. Then you can use IsWindowVisible to see which dialogs, if any, are being displayed and control the behavior accordingly - assuming this is a Windows app.

  3. #3
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: how to manage popup windows?

    in general... popup windows other than singular "expected" messages are a bad idea. You may be able to get away with one or two, but "many" as you put it will be awkward to use.

    You should look at finding a better UI approach. THere are lots of different ways to solve different types of apps. Maybe a docking interface would be more suitable. Or maybe you just need a better way to consolidate information of various windows into a single window. Maybe you need to consolidate all errors/exceptions to a single output window.

    Without thourougly knowing what your app does and how it works, it's hard for any of us to actually advise you.

  4. #4
    Join Date
    Jan 2006
    Posts
    99

    Re: how to manage popup windows?

    I kinda think the api is irrelevant to the problem, but we are using Qt.

    I really want to find a silver bullet, I'm thinking of using state machine.

    error event will send pop up request to the state machine and the state machine will determine if a pop up window is needed.

  5. #5
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: how to manage popup windows?

    a state machine is a data processing engine. It has nothing to do at all with how your UI looks.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured