Pop-Up Menu is not disappearing
Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=5054
Printed Date: 04 March 2025 at 8:28am Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Pop-Up Menu is not disappearing
Posted By: Cowboy
Subject: Pop-Up Menu is not disappearing
Date Posted: 14 September 2006 at 4:07pm
I am implementing a pop-up menu upon right clicking in my app's client window and am using Code Jock's CXTPCommandBars::TrackPopupMenu(...) function call. The menu pops up correctly, but when I switch to a different window, the menu stays up even though the app's window is not the foreground window anymore.
Here is a snippet of the code:
::SetMenuDefaultItem(pSubMenu->m_hMenu, ID_EGA_CLOSE, FALSE);
CPoint pos;
GetCursorPos(&pos);
::SetForegroundWindow(this->m_hWnd);
CXTPCommandBars::TrackPopupMenu(pSubMenu, TPM_NONOTIFY, pos.x, pos.y, this);
Also, when I switch to the MFC TrackPopupMenu(...) call, the pop-up menu works perfectly. What is going on and how can I get the Code Jock menu to work correctly?
FYI, the app window is MFC and not Code Jock.
|
Replies:
Posted By: Oleg
Date Posted: 15 September 2006 at 12:55am
Hi,
What version of Toolkit ?
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
Posted By: Cowboy
Date Posted: 15 September 2006 at 8:46am
Oleg hi!
I am working with Xtreme ToolkitPro 2006 Q2 version 10.2
|
Posted By: Cowboy
Date Posted: 15 September 2006 at 5:13pm
Oleg,
Update:
I've been trying to debug the issue and have discovered that in the working Tray App Demo sample provided in the Code Jock Kit, a WndProc(...) function for the CXTPKeyboardManager class receives a WM_ACTIVATEAPP message.
However, in my app, I never receive this windows message even though I am hooked with the keyboard.
What is the missing link???
|
Posted By: Oleg
Date Posted: 16 September 2006 at 3:58am
Hi,
You also show menu from tray?
Try as in sample create derived class:
class CXTTrayIconEx : public CXTTrayIcon { bool CreateMinimizeWnd(CWnd* /*pWndApp*/) { return true; } };
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
Posted By: Cowboy
Date Posted: 18 September 2006 at 10:10am
My project is not a tray icon with a dialog like the sample, but rather just a simple, small window that lives in the taskbar. My code is based upon http://www.codeproject.com/statusbar/taskbarctrl.asp - a project found in Code Projects. The main difference is that my version has a right-click menu, which I am trying to add Code Jock capability to.
As I indicated before, my class does not inherit from Code Jock but rather from the MFC class "CProgressCtrl". The only place where I implement the Code Jock code is when calling the following line:
CXTPCommandBars::TrackPopupMenu(pSubMenu, TPM_NONOTIFY, pos.x, pos.y, this);
However, when I switch to the MFC call:
::TrackPopupMenu(pSubMenu->m_hMenu, 0, pos.x, pos.y, 0, this->m_hWnd, NULL);
My program works (By this I mean the right-click menu disappears when you click outside of the window)!
What do I need to do to get the Code Jock "TrackPopupMenu" method to work?
|
Posted By: Oleg
Date Posted: 18 September 2006 at 12:00pm
Hi,
this can be problem. OS sends WM_ACTIVATEAPP if your applciation has window that become deactive.... Do you have some not child window like dialog in CodeProject sample? If yes, you need activate it first. If not, I guess you can try create hiddne window and activate it.
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
Posted By: Cowboy
Date Posted: 19 September 2006 at 12:10pm
My project unlike the sample from Code Projects does not have another window nor dialog. The window in the taskbar is created from my winmain and its parent is the taskbar itself.
Sorry, I am not clear on the last half of you post oleg. What would be the benefit of creating a hidden child window? Are you suggesting that user should right-click on this hidden window to bring up the menu rather than on the taskbar window?
|
Posted By: Cowboy
Date Posted: 21 September 2006 at 11:09am
Posted By: Oleg
Date Posted: 21 September 2006 at 12:49pm
Hi,
I need some project to debug/to test. Can you just create new project/copy some parts from your aplication to show problem and attach in issue or here.
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
|