Print Page | Close Window

VB Menu

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=873
Printed Date: 09 May 2024 at 9:07pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: VB Menu
Posted By: amolrajurkar
Subject: VB Menu
Date Posted: 22 June 2004 at 6:55am

How can i create menu in vb using Xtreme Commandbars please post a small example

 

 

Thank you

 

Amol



-------------
Amol Rajurkar



Replies:
Posted By: SuperMario
Date Posted: 22 June 2004 at 7:04am
Take a look at any of the CommandBars sample projects, they include all of the code you need to create a menu.

What type of menu are you looking to create?  Can you be more specific?  This way I can point you to the appropriate sample, or post some sample code.


Posted By: amolrajurkar
Date Posted: 22 June 2004 at 7:11am

sample are not clear to understand me,

I want a small sample add a menu, sub menu and menu items only

 



-------------
Amol Rajurkar


Posted By: SuperMario
Date Posted: 22 June 2004 at 7:31am
This small sample illustrates how to add a popup menu to the menubar called "File" and how to add items to the "File" popup menu.  The "New" menu item added to the "File" popup menu will have a submenu that popups up displaying more menu items.

'Place these constants in the General code section, they are used to identify each menu item.   You will use this id to determine which menu item was clicked, when you are trying to find an item, when you need to update the status of an item, etc....

Const ID_FILE_NEW = 100
Const ID_FILE_OPEN = 101
Const ID_FILE_CLOSE = 102
Const ID_FILE_SAVE = 103
Const ID_FILE_EXIT = 104
Const ID_FILE_NEW_WINDOW = 105
Const  ID_FILE_NEW_TAB = 106

'Place this code in the Form_Load event.  This will add a simple menu to the menubar.   No toolbar is added in this sample.

Private Sub Form_Load()
    Dim Control As CommandBarControl
    Dim ControlFile As CommandBarPopup
    Dim ControlNew As CommandBarPopup
    
    Set ControlFile = CommandBars.ActiveMenuBar.Controls.Add(xtpControlPopup, 0, "&File", -1, False)
    With ControlFile.CommandBar.Controls
        Set ControlNew = .Add(xtpControlPopup, 0, "&New")
        ControlNew.Com mandBar.Controls.Add xtpControlButton, ID_FILE_NEW_WINDOW, "New Navigator"
        ControlNew.CommandBar.Controls.Add xtpControlButton, ID_FILE_NEW_TAB, "New Tab"

        .Add xtpControlButton, ID_FILE_OPEN, "&Open"
 
       Set Control = .Add(xtpControlButton, ID_FILE_CLOSE, "&Close")
        Control.BeginGroup = True
 
        .Add xtpControlButton, ID_FILE_SAVE, "&Save", -1, False
             
        Set Control = .Add(xtpControlButton, ID_FILE_EXIT, "&Exit", -1, False)
        Control.BeginGroup = True
    End With
End Sub

I hope this helps, I tried to keep it simple.  Let me know if you need help using this menu, or if you need help adding a toolbar


Posted By: amolrajurkar
Date Posted: 22 June 2004 at 7:43am

Thank you for the code its working g8t.

Thanks a lot.



-------------
Amol Rajurkar



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