Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - intelligent menus
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

intelligent menus

 Post Reply Post Reply
Author
Message
dajv View Drop Down
Groupie
Groupie


Joined: 27 July 2004
Location: Australia
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote dajv Quote  Post ReplyReply Direct Link To This Post Topic: intelligent menus
    Posted: 27 July 2004 at 11:30pm
Hello,

I'm trying to set menu items to only appear when recently used... as far as I can tell, one sets this by setting the visibility property to "visible if recently used". I've set this for some menu items but it seems to have no effect. What could i be doing wrong?

I also wonder how to set this programmatically? There doesnt seem to be a way, e.g.
Set ControlFile = CommandBars.ActiveMenuBar.Controls.Add(xtpControlPopup, 0, "&File")
With ControlFile.CommandBar.Controls
    Set Control = .Add(xtpControlButton, ID_FILE_NEW, "&New Database...")
    Control.Visibility = "some value resembling recently used"
End With

The visibility property only allows true and false.

Any advice would be appreciated
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 28 July 2004 at 7:10am
Use the AddHiddenCommand method to specify that a menu item to appear hidden.  
This adds the specified command as a hidden command, i.e. an infrequently used command. 
The command will not be displayed in popup menus until the user clicks on the "expand menu"
chevron button or after a short delay when ShowFullAfterDelay is true.

CommandBars.Options.AlwaysShowFullMenus = False
CommandBars.Options.AddHiddenCommand (ID_FILE_SAVE)
CommandBars.Options.AddHiddenCommand (ID_FILE_CLOSE)
CommandBars.Options.AddHiddenCommand (ID_FILE_SAVE_AS)

To hide the control so the user can not see it, use Visible = False
Back to Top
dajv View Drop Down
Groupie
Groupie


Joined: 27 July 2004
Location: Australia
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote dajv Quote  Post ReplyReply Direct Link To This Post Posted: 28 July 2004 at 11:22pm
Thanks for your reply.

Are there any advantages/disadvantages of using a xcb "xtreme command bars designer" file over programmatically creating the menus? That is, other than the initial creation of the menus (i think both are time consuming and probably incur the same amount of time), are tehre any drawbacks of either method?

Back to Top
dajv View Drop Down
Groupie
Groupie


Joined: 27 July 2004
Location: Australia
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote dajv Quote  Post ReplyReply Direct Link To This Post Posted: 29 July 2004 at 7:23pm
I'm having trouble setting commandbar control attributes at run time... I have a command button whos event handler does the following:

1) Private Sub Command1_Click()
2)     Dim ctrl As CommandBarControl
3)     Dim ctrl1 As CommandBarControl
4)     Set ctrl = CommandBars.DesignerControls.Find(, ID_VIEW_STATUSBAR)
5)     ctrl.Caption = "&Status Bar... X"
6)     Set ctrl1 = CommandBars.DesignerControls.Find(, ID_VIEW_STATUSBAR)
7) End sub


As you can see, im using designer controls (at the moment at least). After this has run, the command bar control (a menu item with caption "&Status Bar...") is not updated to read "&Status Bar... X", however stepping through the code i can see that after line 6 ctrl1.Caption DOES equal "&Status Bar... X".

The curious thing is that if i do Control.Caption = "blah" in the CommandBars_Update() or CommandBars_Execute() subs, the menu bar IS updated.

Obviously I will need to make modifications to the menu outside of these subs, so am I doing something wrong?


Edited by dajv
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 29 July 2004 at 9:32pm

The DesignerControls collection of commands only holds commands that are displayed in the "Commands" tab of the Add\remove buttons customize dialog.  This collection is designed to hold all of your applicatio's controls so the user can add\remove them as needed. 

You need to change the caption of the control in CommandBars.ActiveMenuBar or CommandBars(2).FindControl or CommandBars(2).Controls.Find.  FYI: CommandBars(1) is the ActiveMenubar, CommandBars(2) is the first toolbar added, etc...

1) Private Sub Command1_Click()
2)    Dim ctrl As CommandBarControl
3     Set ctrl = CommandBars.ActiveMenuBar.FindControl(, ID_VIEW_STATUSBAR)
4     ctrl.Caption = "&Status Bar... X"
5 End sub

Back to Top
dajv View Drop Down
Groupie
Groupie


Joined: 27 July 2004
Location: Australia
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote dajv Quote  Post ReplyReply Direct Link To This Post Posted: 29 July 2004 at 10:40pm
Thanks SuperMario :)
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.156 seconds.