![]() |
Dynamic menu |
Post Reply ![]() |
Author | ||
yoavo ![]() Senior Member ![]() Joined: 29 February 2004 Location: Israel Status: Offline Points: 140 |
![]() ![]() ![]() ![]() ![]() Posted: 14 June 2004 at 1:36am |
|
|
||
![]() |
||
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
|
pMenuBar->GetControls()->Add(..)
|
||
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
||
![]() |
||
yoavo ![]() Senior Member ![]() Joined: 29 February 2004 Location: Israel Status: Offline Points: 140 |
![]() ![]() ![]() ![]() ![]() |
|
|
||
![]() |
||
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
|
You also can use pMenuBar->LoadMenu.
|
||
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
||
![]() |
||
yoavo ![]() Senior Member ![]() Joined: 29 February 2004 Location: Israel Status: Offline Points: 140 |
![]() ![]() ![]() ![]() ![]() |
|
|
||
![]() |
||
yoavo ![]() Senior Member ![]() Joined: 29 February 2004 Location: Israel Status: Offline Points: 140 |
![]() ![]() ![]() ![]() ![]() |
|
|
||
![]() |
||
superppy ![]() Newbie ![]() Joined: 11 July 2004 Status: Offline Points: 1 |
![]() ![]() ![]() ![]() ![]() |
|
Simple example of dynamic menu : CXTPMenuBar* pMenuBar = GetCommandBars()->GetMenuBar(); pMenuBar->GetControls()->RemoveAll(); UINT nCmdID = 0x8000; CMenu mainMenu; mainMenu.CreateMenu(); CMenu fileMenu; fileMenu.CreateMenu(); fileMenu.AppendMenu(MF_STRING, nCmdID++, "Open"); fileMenu.AppendMenu(MF_SEPARATOR, 0, ""); fileMenu.AppendMenu(MF_STRING, nCmdID++, "New"); mainMenu.AppendMenu(MF_POPUP, (UINT)fileMenu.GetSafeHmenu(), "File"); CMenu editMenu; editMenu.CreateMenu(); editMenu.AppendMenu(MF_STRING, nCmdID++, "Cut"); editMenu.AppendMenu(MF_STRING, nCmdID++, "Paste"); mainMenu.AppendMenu(MF_POPUP,(UINT)editMenu.GetSafeHmenu(), "Edit"); pMenuBar->GetControls()->AddMenuItem(&mainMenu, 0); pMenuBar->GetControls()->AddMenuItem(&mainMenu, 1);
Edited by superppy |
||
![]() |
||
djtompa ![]() Newbie ![]() ![]() Joined: 29 November 2004 Location: Germany Status: Offline Points: 4 |
![]() ![]() ![]() ![]() ![]() |
|
If I have created a menu as stated by superppy then how can I add icons. I tried the following: int nIDIcons[] = {nCmdID};XTPImageManager()->SetIcons(bitmapID, (UINT*) &nIDIcons, sizeof(nIDIcons)/sizeof(nIDIcons[0]), CSize(16, 16));But no icons are shown. Whats wrong? thank you |
||
![]() |
||
SuperMario ![]() Admin Group ![]() ![]() Joined: 14 February 2004 Status: Offline Points: 18057 |
![]() ![]() ![]() ![]() ![]() |
|
nIDIcons is an array of ids for controls in your
menu. It looks like you only have one id in your array. You
need an id for each icon in the bitmap resource. Check that the
id given to your menu controls match the ids in the nIDIcons array.
|
||
![]() |
||
djtompa ![]() Newbie ![]() ![]() Joined: 29 November 2004 Location: Germany Status: Offline Points: 4 |
![]() ![]() ![]() ![]() ![]() |
|
Thank you for your help, but that doesnt seem to be the problem: if I take a nCmdID which belongs to the programs toolbar it wokrs perfectly. It just doesnt work with the cmdIds I generate during the creation of my contect menu. Do I somehow have to "tell" the XTPImageManger which cmdIds I create or something like that? |
||
![]() |
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 |