Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. TrackPopupMenu() blocks message engine

TrackPopupMenu() blocks message engine

Scheduled Pinned Locked Moved C / C++ / MFC
question
13 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    LeeeNN
    wrote on last edited by
    #1

    Hi, everyone, I use TrackPopupMenu() in my CMyView::OnContextMenu() to display a popup menu. But I found that code won't come out TrackPopupMenu(), unless popup menu disappeared. that mean CMyView won't handle any other message except mouse click( which makes popup menu disappeared ). This is not acceptable, in "real-time" data processing. Anybody have any idea?:confused:

    Z L S 3 Replies Last reply
    0
    • L LeeeNN

      Hi, everyone, I use TrackPopupMenu() in my CMyView::OnContextMenu() to display a popup menu. But I found that code won't come out TrackPopupMenu(), unless popup menu disappeared. that mean CMyView won't handle any other message except mouse click( which makes popup menu disappeared ). This is not acceptable, in "real-time" data processing. Anybody have any idea?:confused:

      Z Offline
      Z Offline
      Zac Howland
      wrote on last edited by
      #2

      What exactly are you trying to do? Perhaps someone can offer some alternatives with more information ... If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

      L 1 Reply Last reply
      0
      • Z Zac Howland

        What exactly are you trying to do? Perhaps someone can offer some alternatives with more information ... If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

        L Offline
        L Offline
        LeeeNN
        wrote on last edited by
        #3

        Soory. I don't want my application blocked, when waiting for user is thinking which item in the popup menu to select. because TrackPopupMenu() blocked the message coming in.

        Z 1 Reply Last reply
        0
        • L LeeeNN

          Hi, everyone, I use TrackPopupMenu() in my CMyView::OnContextMenu() to display a popup menu. But I found that code won't come out TrackPopupMenu(), unless popup menu disappeared. that mean CMyView won't handle any other message except mouse click( which makes popup menu disappeared ). This is not acceptable, in "real-time" data processing. Anybody have any idea?:confused:

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          You could have a modeless dialog that the users select options from that raises events back into your view class.... Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert.

          L 1 Reply Last reply
          0
          • L LeeeNN

            Soory. I don't want my application blocked, when waiting for user is thinking which item in the popup menu to select. because TrackPopupMenu() blocked the message coming in.

            Z Offline
            Z Offline
            Zac Howland
            wrote on last edited by
            #5

            I understand the problem you want to prevent. What I don't understand is what you are doing in your application that you need to solve this problem (that information can directly impact the potential solutions). Without that information, there are a few ways to go: - Make your menu handler forward messages it doesn't handle to the parent window (you will need to make sure its parent window is the view). - Use a modeless dialog instead of a menu (non-optimal since you have to duplicate a lot of the menu code that is already done for you). - Don't use context menus. Depending on what you are doing, the first or third options are most likely your best bets. If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

            L 1 Reply Last reply
            0
            • L Lost User

              You could have a modeless dialog that the users select options from that raises events back into your view class.... Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert.

              L Offline
              L Offline
              LeeeNN
              wrote on last edited by
              #6

              Yah, I have thought that way. But is there a way to let popup menu act like a modeless dialog?

              L 1 Reply Last reply
              0
              • L LeeeNN

                Yah, I have thought that way. But is there a way to let popup menu act like a modeless dialog?

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                Not that I am aware of. Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert.

                1 Reply Last reply
                0
                • Z Zac Howland

                  I understand the problem you want to prevent. What I don't understand is what you are doing in your application that you need to solve this problem (that information can directly impact the potential solutions). Without that information, there are a few ways to go: - Make your menu handler forward messages it doesn't handle to the parent window (you will need to make sure its parent window is the view). - Use a modeless dialog instead of a menu (non-optimal since you have to duplicate a lot of the menu code that is already done for you). - Don't use context menus. Depending on what you are doing, the first or third options are most likely your best bets. If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

                  L Offline
                  L Offline
                  LeeeNN
                  wrote on last edited by
                  #8

                  my application have constant data stream coming in, and MyView shows them continuously. When user right click mouse, popup a menu, menu show data's properties, and let user to toggle a feature. so it more like menu in stead of a dialog. My concern is if it take 2 second for user to open popup menu and close the menu, the in coming data stream display will be frozen for that period( I think, not sure yet, because TrackPopupMenu() will stop( frozen App ) ) dialog is a option, but as you said non-optimal. I did not understand your first option. any idea? Thank you.

                  Z 1 Reply Last reply
                  0
                  • L LeeeNN

                    my application have constant data stream coming in, and MyView shows them continuously. When user right click mouse, popup a menu, menu show data's properties, and let user to toggle a feature. so it more like menu in stead of a dialog. My concern is if it take 2 second for user to open popup menu and close the menu, the in coming data stream display will be frozen for that period( I think, not sure yet, because TrackPopupMenu() will stop( frozen App ) ) dialog is a option, but as you said non-optimal. I did not understand your first option. any idea? Thank you.

                    Z Offline
                    Z Offline
                    Zac Howland
                    wrote on last edited by
                    #9

                    The first option would go something like this: You derived your own class from CMenu that handles initialization etc. Additionally, you override handlers for messages you expect to see in your main window and forward them to it. Also, if your data is being transmitted via window messages, the input won't "stop" but rather appear paused until the user selects an option or clicks off the menu (which is desirable). When the menu goes away, the cached window messages will be handled until your app has caught up with the data stream. If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

                    1 Reply Last reply
                    0
                    • L LeeeNN

                      Hi, everyone, I use TrackPopupMenu() in my CMyView::OnContextMenu() to display a popup menu. But I found that code won't come out TrackPopupMenu(), unless popup menu disappeared. that mean CMyView won't handle any other message except mouse click( which makes popup menu disappeared ). This is not acceptable, in "real-time" data processing. Anybody have any idea?:confused:

                      S Offline
                      S Offline
                      Stephen Hewitt
                      wrote on last edited by
                      #10

                      It sounds like your application might be a good candidate for multiple threads. Steve

                      R 1 Reply Last reply
                      0
                      • S Stephen Hewitt

                        It sounds like your application might be a good candidate for multiple threads. Steve

                        R Offline
                        R Offline
                        Ryan Binns
                        wrote on last edited by
                        #11

                        Exactly what I was thinking... Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

                        S 1 Reply Last reply
                        0
                        • R Ryan Binns

                          Exactly what I was thinking... Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

                          S Offline
                          S Offline
                          Stephen Hewitt
                          wrote on last edited by
                          #12

                          Great minds think alike ;) Steve

                          R 1 Reply Last reply
                          0
                          • S Stephen Hewitt

                            Great minds think alike ;) Steve

                            R Offline
                            R Offline
                            Ryan Binns
                            wrote on last edited by
                            #13

                            Absolutely :)

                            Ryan

                            "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups