Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Pop-Up Menu is not disappearing
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Pop-Up Menu is not disappearing

 Post Reply Post Reply
Author
Message
Cowboy View Drop Down
Newbie
Newbie
Avatar

Joined: 14 September 2006
Location: United States
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Cowboy Quote  Post ReplyReply Direct Link To This Post Topic: Pop-Up Menu is not disappearing
    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.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2006 at 12:55am
Hi,
What version of Toolkit ?
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Cowboy View Drop Down
Newbie
Newbie
Avatar

Joined: 14 September 2006
Location: United States
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Cowboy Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2006 at 8:46am
Oleg hi!

I am working with Xtreme ToolkitPro 2006 Q2 version 10.2

Back to Top
Cowboy View Drop Down
Newbie
Newbie
Avatar

Joined: 14 September 2006
Location: United States
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Cowboy Quote  Post ReplyReply Direct Link To This Post 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???
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Cowboy View Drop Down
Newbie
Newbie
Avatar

Joined: 14 September 2006
Location: United States
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Cowboy Quote  Post ReplyReply Direct Link To This Post 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 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?
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Cowboy View Drop Down
Newbie
Newbie
Avatar

Joined: 14 September 2006
Location: United States
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Cowboy Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
Cowboy View Drop Down
Newbie
Newbie
Avatar

Joined: 14 September 2006
Location: United States
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Cowboy Quote  Post ReplyReply Direct Link To This Post Posted: 21 September 2006 at 11:09am
Bump...
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.125 seconds.