Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Docking Pane
  New Posts New Posts RSS Feed - Drawing problems
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Drawing problems

 Post Reply Post Reply
Author
Message
jamiei View Drop Down
Newbie
Newbie


Joined: 01 November 2003
Location: United Kingdom
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote jamiei Quote  Post ReplyReply Direct Link To This Post Topic: Drawing problems
    Posted: 04 November 2003 at 3:37pm

I've got a standard SDI MFC app that I'm using two docking panes with.

When these are docked to the left and then hidden, it seems to have trouble drawing them correctly on expanding, once it gets to a certain point it flickers and misses part of the dock + view.

I've attached a picture of what I'm talking about. Weirdly, if I dock them on the bottom or top it seems to work ok.

396_DockDraw.zip

Back to Top
kstowell View Drop Down
Admin Group
Admin Group


Joined: 25 January 2003
Location: MIchigan, USA
Status: Offline
Points: 496
Post Options Post Options   Thanks (0) Thanks(0)   Quote kstowell Quote  Post ReplyReply Direct Link To This Post Posted: 04 November 2003 at 6:37pm

Hello,

Try adding the WS_CLIPCHILDREN style to your CMainFrame class, for example:

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
    if( !CFrameWnd::PreCreateWindow(cs) )
        return FALSE;

    // TODO: Modify the Window class or styles here by modifying
    // the CREATESTRUCT cs

    cs.style |= WS_CLIPCHILDREN|WS_CLIPSIBLINGS;

    return TRUE;
}

Please let me know if this helps.

Cheers,
Codejock Support

Back to Top
jamiei View Drop Down
Newbie
Newbie


Joined: 01 November 2003
Location: United Kingdom
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote jamiei Quote  Post ReplyReply Direct Link To This Post Posted: 05 November 2003 at 5:58pm

That worked great, thanks.

Incidentally, I'm having trouble with a context menu in the docking pane (well the view that's attached to one anyway). It seems that I can only provide implementations for the ON_COMMAND or ON_UPDATE_COMMAND_UI handlers, not both. I was wondering if you might be able to suggest any reasons why this might be happening?

Thanks again,

Jamie



Edited by jamiei
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: 05 November 2003 at 11:32pm

I tring to add context menu in "Advanced" sample

void CHeroesView::OnContextMenu(CWnd* pWnd, CPoint point)

{

CMenu mnu;

mnu.LoadMenu(IDR_MAINFRAME);

CXTPCommandBars::TrackPopupMenu(&mnu, 0, point.x, point.y, this);

}

 

All work as expected.  How do you call the menu?

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
jamiei View Drop Down
Newbie
Newbie


Joined: 01 November 2003
Location: United Kingdom
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote jamiei Quote  Post ReplyReply Direct Link To This Post Posted: 13 November 2003 at 4:29pm

Oleg,

Sorry for not replying sooner.

I tried using your code above, but for some reason my ON_COMMAND_UPDATE handler isn't being called. However, I was using the following and it almost worked:

 CMenu menu;
 menu.LoadMenu(IDR_MONITORS_MENU);

 CMenu* pSubMenu = menu.GetSubMenu(0);
 // Display the menu at the current mouse location. There's a "bug"
 // (Microsoft calls it a feature) in Windows 95 that requires calling
 // SetForegroundWindow. To find out more, search for Q135788 in MSDN.
 //
 CPoint point;
 GetCursorPos(&point);
 ::SetForegroundWindow(m_hWnd);
 //ClientToScreen(&point);
 GetCursorPos(&m_ptCursorPos);
 
 CXTPFrameWnd* pFrameWnd = (CXTPFrameWnd*)AfxGetMainWnd();
 ASSERT_VALID(pFrameWnd);
 CXTPCommandBars::TrackPopupMenu(pSubMenu, 0, point.x, point.y, this);
 
 ::PostMessage(m_hWnd, WM_NULL, 0, 0);
 
 menu.DestroyMenu();

 

I'm using this context menu in a TreeView derived class (within a docking pane). If a user highlights a tree item it should enable one of the menu options. Although this works (enabling/disabling), if I then click on the item to action the handler, it doesn't do anything and I get a warning in the debug window: "Warning: not executing disabled command 39776"

Is it something odd to do with the cursor being updated when I click on the item and the update handler's called again, and disables it?

 

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.219 seconds.