Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Skin Framework
  New Posts New Posts RSS Feed - Menu won't draw.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Menu won't draw.

 Post Reply Post Reply
Author
Message
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 973
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Topic: Menu won't draw.
    Posted: 4 hours 39 minutes ago at 2:50pm
The menu added to a window won't draw when a skin is active. I have debugged and see CXTPSkinManagerSchema::CalcFrameBorders is called but it isn't calculating any width. All the relevant menu methods seem to get called. The class being used for the window is CXTPSkinObjectApplicationFrame.

Here is the minimum code:

static const TCHAR s_szAddInManagerDialogClass[] = TEXT("AddInManagerDialogClass");
static const TCHAR s_szAddInManagerMenuText[] = TEXT("Item 1");
static const UINT s_nAddInManagerMenuItem = 1001;


  HWND hDialog;
  WNDCLASSEX wc = { 0 };
  wc.cbSize = sizeof(WNDCLASSEX);
  wc.lpfnWndProc = AddInManagerWndProc;
  wc.hInstance = GetModuleHandle(NULL);
  wc.lpszClassName = s_szAddInManagerDialogClass;
  wc.cbWndExtra = DLGWINDOWEXTRA;
  if (!RegisterClassEx(&wc) && GetLastError() != ERROR_CLASS_ALREADY_EXISTS)
  {
      return HRESULT_FROM_WIN32(GetLastError());
  }

  hDialog = CreateWindowEx(WS_EX_CLIENTEDGE, s_szAddInManagerDialogClass, TEXT("Dialog with menu"),
    WS_OVERLAPPEDWINDOW | WS_VISIBLE,
    100, 100, 500, 300, NULL, NULL, GetModuleHandle(NULL), NULL);
  if (!hDialog)
  {
      return HRESULT_FROM_WIN32(GetLastError());
  }

  HMENU hMenu = ::CreateMenu();
  HMENU hSubMenu = ::CreatePopupMenu();
  AppendMenu(hSubMenu, MF_OWNERDRAW, s_nAddInManagerMenuItem, s_szAddInManagerMenuText);
  AppendMenu(hMenu, MF_POPUP, (UINT_PTR)hSubMenu, TEXT("Menu"));

    SetMenu(hDialog, hMenu);
    DrawMenuBar(hDialog);



If I turn off the skin (I added code to draw the menu items to make sure it wasn't a black on black issue:

Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 973
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 4 hours 37 minutes ago at 2:52pm
Sorry, ignore "I have debugged and see CXTPSkinManagerSchema::CalcFrameBorders is called but it isn't calculating any width." The width isn't being used. The system menu does draw but the menu added to the window doesn't.
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 973
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 4 hours 36 minutes ago at 2:53pm
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 973
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 4 hours 31 minutes ago at 2:58pm
Sorry as I hack thru this website. Pasted images show up in the page but when I "Post Reply" I see nothing. Hope this shows up. Left side is what I see when clicking "Menu". Right side has the skin and nothing shows up when I click "Menu". System menu shows up just fine.
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 973
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 4 hours 28 minutes ago at 3:01pm
Seems to be perhaps the wrong skin class? I have found that no matter where I click in the "Menu" bar area the StartMenuState function is called and the only menu it supports seems to be the system menu.
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 973
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 4 hours 12 minutes ago at 3:17pm
Changing the window class to "#32770" didn't help. Class handler is still CXTPSkinObjectApplicationFrame. I'm beginning to think CJ skin system simply doesn't handle this OS SetMenu call and/or the creation of the menu.

How about it CJ, what's my option here? I don't actually own the code that is failing whenever a skin is present. Do I have to have the actual programmers give me window class names to exclude from skinning?
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.047 seconds.