Print Page | Close Window

MenuItem Custom Draw not implemented ?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Skin Framework
Forum Description: Topics Related to Codejock Skin Framework
URL: http://forum.codejock.com/forum_posts.asp?TID=7728
Printed Date: 27 November 2024 at 4:17am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: MenuItem Custom Draw not implemented ?
Posted By: dbrulhart
Subject: MenuItem Custom Draw not implemented ?
Date 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



Replies:
Posted By: Oleg
Date 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


Posted By: Oleg
Date Posted: 04 August 2007 at 2:18am
https://forum.codejock.com/uploads/20070804_021830_Logo.zip - uploads/20070804_021830_Logo.zip  - Small sample.

-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: dbrulhart
Date 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


Posted By: dbrulhart
Date 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


Posted By: dbrulhart
Date 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



Posted By: dbrulhart
Date 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


Posted By: dbrulhart
Date 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


Posted By: Oleg
Date 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


Posted By: dbrulhart
Date 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
 


Posted By: Oleg
Date Posted: 08 August 2007 at 2:15am
Hello,
Its not very good solution.
Check Samples\CommandBars\DynamicPopups samples.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: dbrulhart
Date Posted: 08 August 2007 at 5:16am
Hi Oleg,
 
Thanks a lot, works fine and much more elegant.
 
Cheers,
 
Dominique



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net