MenuItem Custom Draw not implemented ? |
Post Reply |
Author | |
dbrulhart
Groupie Joined: 19 October 2006 Location: Switzerland Status: Offline Points: 38 |
Post Options
Thanks(0)
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 |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello,
to draw custom items you can override CXTPControlButton and its Draw and GetSize methods.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
uploads/20070804_021830_Logo.zip - Small sample.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
dbrulhart
Groupie Joined: 19 October 2006 Location: Switzerland Status: Offline Points: 38 |
Post Options
Thanks(0)
|
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
|
|
dbrulhart
Groupie Joined: 19 October 2006 Location: Switzerland Status: Offline Points: 38 |
Post Options
Thanks(0)
|
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
|
|
dbrulhart
Groupie Joined: 19 October 2006 Location: Switzerland Status: Offline Points: 38 |
Post Options
Thanks(0)
|
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 |
|
dbrulhart
Groupie Joined: 19 October 2006 Location: Switzerland Status: Offline Points: 38 |
Post Options
Thanks(0)
|
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
|
|
dbrulhart
Groupie Joined: 19 October 2006 Location: Switzerland Status: Offline Points: 38 |
Post Options
Thanks(0)
|
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
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
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 |
|
dbrulhart
Groupie Joined: 19 October 2006 Location: Switzerland Status: Offline Points: 38 |
Post Options
Thanks(0)
|
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
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello,
Its not very good solution.
Check Samples\CommandBars\DynamicPopups samples.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
dbrulhart
Groupie Joined: 19 October 2006 Location: Switzerland Status: Offline Points: 38 |
Post Options
Thanks(0)
|
Hi Oleg,
Thanks a lot, works fine and much more elegant.
Cheers,
Dominique
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |