Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - how to create menuitem with 2 icons
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

how to create menuitem with 2 icons

 Post Reply Post Reply
Author
Message
Raj.krishnan View Drop Down
Groupie
Groupie
Avatar

Joined: 16 January 2006
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote Raj.krishnan Quote  Post ReplyReply Direct Link To This Post Topic: how to create menuitem with 2 icons
    Posted: 30 March 2006 at 3:13am

Hello All,

    Can anyone tell me how to create menuitems to display with two icons . (Check icon and someother icon ) . I should display the check icon and also other icon with a particular menu item . Like the one display in latest msdn .  I have attached the image in the zip file . Pleas help on this issue.2006-03-30_031203_2icon.zip

 

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: 30 March 2006 at 10:23am

Sorry link don't work... Show image as is  (click Image Upload)

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Raj.krishnan View Drop Down
Groupie
Groupie
Avatar

Joined: 16 January 2006
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote Raj.krishnan Quote  Post ReplyReply Direct Link To This Post Posted: 30 March 2006 at 11:18pm

Hi Oleg,

  It is opening for me when i extract from zip file .I will attach the gif file of the image.I want the samething to be shown in the menu item of a menubar.how to do it for a menu popup for a button control in the toolbar. 

 

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: 31 March 2006 at 7:46am

Hello,

Call pPopupBar->SetDoubleGripper(TRUE); for this popup bar.

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Raj.krishnan View Drop Down
Groupie
Groupie
Avatar

Joined: 16 January 2006
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote Raj.krishnan Quote  Post ReplyReply Direct Link To This Post Posted: 03 April 2006 at 12:03am

Hi Oleg,

  My requirement is like this we are creating a toolbar in that a button has to popup a menu like that.

m_wndMenuBar is a member of CXTPToolBar

CMenu *pSubMenu = NULL;
 m_wndMenuBar.CreateToolBar(WS_VISIBLE|WS_CHILD, this, AFX_IDW_TOOLBAR + 2);
 m_wndMenuBar.LoadToolBar( IDR_MENU_TOOLBAR );
 m_wndMenuBar.SetButtonSize(CSize( 44, DEFAULTBUTTONSIZE));
 m_wndMenuBar.SetIconSize(CSize(40, 11));
 
 CXTPControl *pCtrl = m_wndMenuBar.GetControls()->GetAt(0);
 CXTPControlPopup *pBtnCtrl = (CXTPControlPopup*)m_wndMenuBar.GetControls()->SetControl Type(pCtrl, xtpControlButtonPopup);
 
 m_cMenu.LoadMenu( IDR_OPTIONS_MENU );
 pSubMenu = m_cMenu.GetSubMenu(0);

So please help on this issue to solve this problem because i dont know how to get the CXTPPopupBar from CXTPControlPopup to set the Gripper for the menu.

 

 

 

Back to Top
Raj.krishnan View Drop Down
Groupie
Groupie
Avatar

Joined: 16 January 2006
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote Raj.krishnan Quote  Post ReplyReply Direct Link To This Post Posted: 03 April 2006 at 1:01am

Hi Oleg,

I need it for the mainmenu and also for its submenu.I need it like this.Please help on this issue.

 

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: 03 April 2006 at 7:45am

Hello, here code

CXTPPoupBar*pPopupBar = (CXTPPoupBar*)pBtnCtrl->GetCommandBar();

pPopupBar ->SetDoubleGripper(TRUE)

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Raj.krishnan View Drop Down
Groupie
Groupie
Avatar

Joined: 16 January 2006
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote Raj.krishnan Quote  Post ReplyReply Direct Link To This Post Posted: 03 April 2006 at 11:33pm

Hi Oleg,

It is working for main menu but its not workng for the submenu of the main menu.Also ow i can set icon for popup submenu item that is Zoom In / Zoom Out . Please help on this issue.

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 April 2006 at 9:22am

Hello,

1. to set icon  call pControl->SetStyle(xtpButtonIconAndCaption); and assign iconId

pControl->SetIconId(ID_ICON);

 

2. to set sublemnu double gripper find its popupbar and call SetDoubleGripper for it.

 

CXTPPoupBar*pPopupBarChild = (CXTPPoupBar*)pPopupBar->GetControl(7)->GetCommandBar( );

pPopupBarChild->SetDoubleGripper(TRUE);

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Raj.krishnan View Drop Down
Groupie
Groupie
Avatar

Joined: 16 January 2006
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote Raj.krishnan Quote  Post ReplyReply Direct Link To This Post Posted: 05 April 2006 at 12:55am

Hello Oleg,

When i tried to do get the pPopupBarChild pointer it is crashing since  (CXTPPoupBar*)pPopupBar->GetControl(7) is returning NULL so i can't set icon also for that menu item.I will be staying here till night so please help on this issue to resolve.

Raj
Software Engineer
eGrabber Inc
http://vcfreax.blogspot.com/
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: 05 April 2006 at 8:14am

???

instead 7 use index you need. I don't know how much items you have in popup and where your popup control.

 

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Raj.krishnan View Drop Down
Groupie
Groupie
Avatar

Joined: 16 January 2006
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote Raj.krishnan Quote  Post ReplyReply Direct Link To This Post Posted: 06 April 2006 at 12:40am

Hello Oleg,

m_wndLayer2ToolBar.CreateToolBar(WS_VISIBLE|WS_CHILD|CBRS_TO OLTIPS, this, AFX_IDW_TOOLBAR + 3);
 m_wndLayer2ToolBar.LoadToolBar(IDR_BUTTONS_TOOLBAR);
 

 pCtrl = m_wndLayer2ToolBar.GetControls()->FindControl(ID_BUDDYLIS T_BTN);
 pCtrl->SetStyle(xtpButtonIcon);
 pBtnCtrl = (CXTPControlPopup*)m_wndLayer2ToolBar.GetControls()->SetC ontrolType(pCtrl, xtpControlPopup);

 CMenu cMenu;
 cMenu.LoadMenu( IDR_BUDDYBTN_MENU );
 pSubMenu = cMenu.GetSubMenu(0);
 
 if( pSubMenu && pBtnCtrl )
 {
  pBtnCtrl->SetCommandBar( pSubMenu );
 }
 
 pCtrl = m_wndLayer2ToolBar.GetControls()->FindControl( ID_GOACTION_BUTTON );
 pCtrl->SetStyle(xtpButtonIcon);
 pBtnCtrl = (CXTPControlPopup*)m_wndLayer2ToolBar.GetControls()->SetC ontrolType(pCtrl, xtpControlSplitButtonPopup );

 CMenu  cSubMenu;
 cSubMenu.LoadMenu( IDR_GO_OPTIONSMENU );
 pSubMenu = cSubMenu.GetSubMenu(0);

 if( pSubMenu && pBtnCtrl )
 {
  // Rajkumar Apr 3 2006
  pBtnCtrl->SetCommandBar( pSubMenu );
 
  pCommandBar = pBtnCtrl->GetCommandBar();
  if (pCommandBar)
  {
   CXTPPopupBar *pPopupBar = (CXTPPopupBar*)pCommandBar;
   if (pPopupBar)
   {
    pPopupBar->SetDoubleGripper(TRUE) ;

    CXTPpChildPopupBar *pChildPopupBar = (CXTPPopupBar*)pPopupBar->GetControl(10)->GetCommandBa r();
    if (pChildPopupBar )
    {
           pPopupBarChild->SetDoubleGripper(TRUE);
     }
    }
   }
   }
  }

When i tried to get the the ppopupBarChild it is crashing while i debugged this is where it is crashing

CXTPControl* CXTPCommandBar::GetControl(int nIndex) const
{
 //Ensure the index falls within the correct range.
 if ((nIndex >= 0) && (nIndex < m_pControls->GetCount()))
 {
  return m_pControls->GetAt(nIndex);
 }
 return NULL;

this function is returning NULL  that is why it cant get the pointer

my menubar is the same what i had sent earlier with menu iitem ( copy,New etc... ) in the previous mail

So please help on this issue i dont what i have to do give me a sample also how to do it in the ame manner.

Raj
Software Engineer
eGrabber Inc
http://vcfreax.blogspot.com/
Back to Top
Raj.krishnan View Drop Down
Groupie
Groupie
Avatar

Joined: 16 January 2006
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote Raj.krishnan Quote  Post ReplyReply Direct Link To This Post Posted: 06 April 2006 at 11:47pm

Hi Oleg,

I had already sent the code for the following . Please help me to solve this issue . Its a very important one in our module .

Raj
Software Engineer
eGrabber Inc
http://vcfreax.blogspot.com/
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 April 2006 at 9:45am

The line:

pPopupBar->GetControl(10)

 

So Are you sure you need index 10? Double check it.

if it returns NULL it mean index out of range.

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Raj.krishnan View Drop Down
Groupie
Groupie
Avatar

Joined: 16 January 2006
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote Raj.krishnan Quote  Post ReplyReply Direct Link To This Post Posted: 08 April 2006 at 7:38am

Hello Oleg ,

Thanks for the reply . Thing is its crashing because

m_pControls->GetCount()

is less than the nIndex i dont know how to set the m_pControls Count.Give me a solution on this why it is less than my index . I had already sent you the code.

CXTPControl* CXTPCommandBar::GetControl(int nIndex) const
{
 //Ensure the index falls within the correct range.
 if ((nIndex >= 0) && (nIndex < m_pControls->GetCount()))
 {
  return m_pControls->GetAt(nIndex);
 }
 return NULL;
}

Raj
Software Engineer
eGrabber Inc
http://vcfreax.blogspot.com/
Back to Top
Raj.krishnan View Drop Down
Groupie
Groupie
Avatar

Joined: 16 January 2006
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote Raj.krishnan Quote  Post ReplyReply Direct Link To This Post Posted: 11 April 2006 at 7:06am

Hello Oleg,

Can you check me and tell what is the issue please!!

Raj
Software Engineer
eGrabber Inc
http://vcfreax.blogspot.com/
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: 11 April 2006 at 7:37am

Hello,

Create with wizard new application, recreate this issue and attach here. I will show what you must to change.

Can't understand why it is so difficult for you. All you need is specify index of your popup control.

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Raj.krishnan View Drop Down
Groupie
Groupie
Avatar

Joined: 16 January 2006
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote Raj.krishnan Quote  Post ReplyReply Direct Link To This Post Posted: 04 May 2006 at 7:16am

Hello Oleg,

   I need to set the same two icons for a right click menu . can you help me to solve the issue how to add two icons in right click menu.

Raj
Software Engineer
eGrabber Inc
http://vcfreax.blogspot.com/
Back to Top
JamesH View Drop Down
Senior Member
Senior Member


Joined: 01 December 2004
Status: Offline
Points: 147
Post Options Post Options   Thanks (0) Thanks(0)   Quote JamesH Quote  Post ReplyReply Direct Link To This Post Posted: 06 July 2006 at 6:57pm
I'm having a problem with the doubleGripper as well.
 
I have a CommandBarPopup pointer:
 
ICommandBarPopupPtr popup;
 
And I add tools to it using:
    ctrl = popup->CommandBar->Controls->Add( XtremeCommandBars::xtpControlButton, (long)ts->ctrlID, A2W( (char*)(ts->caption) ), vtMissing, VARIANT_TRUE);
I set the control to be checked:
   ctrl->Checked = ts->depressed;   
And then I set the double gripper so those tools should have an icon and a check mark:
 
    popup->CommandBar->DoubleGripper = VARIANT_TRUE;    
The tools show up in the correct checked or unchecked state but just with the single gripper (ie. no check mark, just a highlighted icon).
 
Any ideas?
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 July 2006 at 8:56am
Hi,
 
 
In our WTL sample I added:
 
 XtremeCommandBars::ICommandBarPopupPtr popup = m_spCommandBars->GetActiveMenuBar()->Controls->GetItem(1);
 popup->CommandBar->DoubleGripper = VARIANT_TRUE; 
 
and it works as expected. Check your code.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
JamesH View Drop Down
Senior Member
Senior Member


Joined: 01 December 2004
Status: Offline
Points: 147
Post Options Post Options   Thanks (0) Thanks(0)   Quote JamesH Quote  Post ReplyReply Direct Link To This Post Posted: 07 July 2006 at 12:16pm
Hey Oleg,
 
Thanks for the quick response.  Your right it was something dumb, the menu created is later copied before being displayed and the copy didn't copy over the DoubleGripper property. Embarrassed
 
Thanks again,
- James
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.172 seconds.