Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Skin Framework
  New Posts New Posts RSS Feed - MenuItem Custom Draw not implemented ?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

MenuItem Custom Draw not implemented ?

 Post Reply Post Reply
Author
Message
dbrulhart View Drop Down
Groupie
Groupie


Joined: 19 October 2006
Location: Switzerland
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote dbrulhart Quote  Post ReplyReply Direct Link To This Post Topic: MenuItem Custom Draw not implemented ?
    Posted: 03 August 2007 at 10:36am
Hi all,
 
As mentionned in threads #6308 and #4094 standard menus are not yet implement when using the SkinFramework.
 
I had then to move my code to CXTPCommandBars and CXTPMenuBar, which works fine...
 
...except that I cannot find any way to customize the drawing of the menu items as I did previously with:

CMainFrame::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)

Am I missing something ?
 
Thanks to all for your help
 
Dominique
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: 04 August 2007 at 2:17am
Hello,
 
to draw custom items you can override CXTPControlButton and its Draw and GetSize methods.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
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: 04 August 2007 at 2:18am
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
dbrulhart View Drop Down
Groupie
Groupie


Joined: 19 October 2006
Location: Switzerland
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote dbrulhart Quote  Post ReplyReply Direct Link To This Post Posted: 06 August 2007 at 3:14am
Hi Oleg,
 
Thanks for the quick reply.
 
This could work, and that's what I use in the other (smaller) app we've skinned.
 
The problem with the app I'm working now on, is that it is quite large and there's a lot of menu items... and all of them have to be customized (historical issue).
 
Is there any way I can avoid creating a CXTPControl for every item ?
 
A simple callback would be much more convenient (like OnDrawItem())... specially as the menu is often reconfigured and completely recreated.
 
Thanks a lot in advance
 
Dominique
Back to Top
dbrulhart View Drop Down
Groupie
Groupie


Joined: 19 October 2006
Location: Switzerland
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote dbrulhart Quote  Post ReplyReply Direct Link To This Post Posted: 06 August 2007 at 3:52am

Hi again,

Just noticed that the XTPMenu Bar seems hooking the Alt key to open menu automatically.

We had disabled this previously as we have implemented our own Accelerator mechanism and process any key command in CWinApp::PretranslateMessage(), but it seems XTP hooks it before us.

Is there anyway to disable this ?
 
I also noticed that if we set menu item text to: New File\tCtrl + N, then the Ctrl + N is not displayed. Any reason for this ? Or any way to re-enable this ?
 
Thanks again
 
Dominique
Back to Top
dbrulhart View Drop Down
Groupie
Groupie


Joined: 19 October 2006
Location: Switzerland
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote dbrulhart Quote  Post ReplyReply Direct Link To This Post Posted: 06 August 2007 at 4:36am

Hi again,

Just noticed also that the I've lost the MDI Window menu listing open documents.

Any attempts to overidde the MFC OnUpdateFrameMenu() and tweak in to get the Widow menu back failed.

Is there a way in XTPMenuBar to handle this ?

Thanks again

Dominique

Back to Top
dbrulhart View Drop Down
Groupie
Groupie


Joined: 19 October 2006
Location: Switzerland
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote dbrulhart Quote  Post ReplyReply Direct Link To This Post Posted: 06 August 2007 at 9:38am
Hi again,
 
Managed to fix the Shortcuts issue: pCommandBars->GetCommandBarsOptions()->bAutoUpdateShortcuts = FALSE
 
and the MDI Window menu issue: Had to add a Window = 35000 menu item in the .rc. Was not necessary previously. Is this a MCF or XTP issue ?
 
Could also avoid deriving the CXPTControl for custom menu item drawing. Just derived the CXTPOfficeTheme class and overide DrawControlPopupParent(). Works fine now.
 
Still fighting with Alt key opening the menus. Any way to disable this welcome.
 
Thanks again
 
Dominique
Back to Top
dbrulhart View Drop Down
Groupie
Groupie


Joined: 19 October 2006
Location: Switzerland
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote dbrulhart Quote  Post ReplyReply Direct Link To This Post Posted: 06 August 2007 at 11:16am

Hi again,

Finally found how to disable the menu activation through the Alt key:

pCommandBars->GetCommandBarsOptions()->keyboardCuesUse = xtpKeyboardCuesUseNone

Sorry to all I bothered wih this thread.
 
Thanks again
 
Dominique
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: 07 August 2007 at 12:36am
Hello,
 
Sorry for delay. Seems you resolved almost all your questions. :)
Right, for MDI menulist just add new menu item with id = 35000. Its XTP thing which allows add menu items to any submenu.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
dbrulhart View Drop Down
Groupie
Groupie


Joined: 19 October 2006
Location: Switzerland
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote dbrulhart Quote  Post ReplyReply Direct Link To This Post Posted: 07 August 2007 at 10:03am
Hi Oleg,
 
As per the menus issues, all seems fine for now.
 
However, I'm wondering if there would something better to do than what I'm currently doing:
 
We have to modify the Edit menu after each operation in the software to update the History submenu. We then keep updating the HMENU as before and call XTPMenuBar->LoadMenu() everytime.
 
Is this consuming a lot of GDI resources ?
 
Any better solution
 
Thanks again
 
Dominique
 
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: 08 August 2007 at 2:15am
Hello,
Its not very good solution.
Check Samples\CommandBars\DynamicPopups samples.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
dbrulhart View Drop Down
Groupie
Groupie


Joined: 19 October 2006
Location: Switzerland
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote dbrulhart Quote  Post ReplyReply Direct Link To This Post Posted: 08 August 2007 at 5:16am
Hi Oleg,
 
Thanks a lot, works fine and much more elegant.
 
Cheers,
 
Dominique
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.188 seconds.