TrackPopupMenu() blocks message engine
-
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:
-
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:
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
-
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
-
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:
-
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.
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
-
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.
-
Yah, I have thought that way. But is there a way to let popup menu act like a modeless dialog?
-
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
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.
-
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.
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
-
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:
It sounds like your application might be a good candidate for multiple threads. Steve
-
It sounds like your application might be a good candidate for multiple threads. Steve
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"
-
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"
Great minds think alike ;) Steve
-
Great minds think alike ;) Steve
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"