Menu item separator without using BeginGroup
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=11023
Printed Date: 06 November 2025 at 6:46am Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Menu item separator without using BeginGroup
Posted By: nighthawk
Subject: Menu item separator without using BeginGroup
Date Posted: 13 June 2008 at 8:41am
I have a proposal for a new feature:
It is very frustrating for me to have the menu/toolbar separator attached to a specific menu item (by setting Control.BeginGroup = True). There are a number of places in my programs where I change the visibility of individual menu items during runtime and if I hide the first menu item in a group, I have to go through and change the BeginGroup property on the next visible menu item. This is frustrating and can get complicated when there are lots of menu items that change visibility.
I would love it if you can make it possible to add a separator that floats in a specific spot. For example, the built-in VB6 menu editor does not attach the separator to any other menu item so I can hide the menu items above and below the separator without effecting the separator itself. One way this could be done is to set aside a special menu id value that will add a separator in that position:
CommandBar.Controls.Add(xtpControlButton, 1, "Item1", -1, False) CommandBar.Controls.Add(xtpControlButton, SEPARATOR_ID, "-", -1, False) CommandBar.Controls.Add(xtpControlButton, 2, "Item2", -1, False) CommandBar.Controls.Add(xtpControlButton, 3, "Item3", -1, False)
In the above example, I can hide Item2 at runtime and still have the separator dividing Item1 and Item3.
Just a thought.
|
Replies:
Posted By: shipwreck
Date Posted: 20 June 2008 at 8:23pm
Any specific reason why you would want to do this, If you like the "Aqua" look, you can just add another control in the menu, maybe a label perhaps? Make it's caption blank, and disable it. It will be there, in the order you have loaded your controls.
------------- Product: Xtreme Suite Pro (Active-X), Version 15.3.1
Platform: Windows 7 Ultimate SP1 (64Bit) & Windows XP Mode SP3 (32Bit)
Language: Visual Basic 6.0 SP6
|
Posted By: nighthawk
Date Posted: 27 June 2008 at 4:38pm
|
Unfortunately, a blank label still leaves a space where the caption would normally be displayed. I don't want any spacing between the stand-alone group separator line and the menu buttons above and below.
|
Posted By: stefanadelbert
Date Posted: 30 April 2009 at 7:50pm
I'm having exactly the same issue, and definitely don't want to have to do the extra housekeeping of applying the separator to the next applicable menu item.
Is there any other way of achieving this?
|
Posted By: nighthawk
Date Posted: 30 April 2009 at 9:06pm
I found the following workaround. Adding a menu item using the following code creates a separator independent of any menu item:
Dim Control As XtremeCommandBars.CommandBarControl
Set Control = CommandBar.Controls.Add(xtpControlGallery, Id, "") Control.Height = 0 Control.Width = 0 Control.BeginGroup = True
(This also works for toolbar separators)
The only problem I have encountered is that if there is a situation where a lot of normal menu items are hidden, I can sometimes end up with separators in unwanted spots. For example, sometimes I can end up with a separator in the very first or last position of a menu. Also, I can sometimes end up with two separators next to each other. This doesn't look good so I wrote a function that loops through all the menus and toolbars and hide seperators when they are show up in these unwanted places.
------------- Product: Xtreme SuitePro (ActiveX) version 13.0.0
Platform: Windows XP (32bit) - SP 3
Language: Visual Basic 6.0
|
Posted By: chrisABC
Date Posted: 05 May 2009 at 3:27pm
nighthawk wrote:
Iso I wrote a function that loops through all the menus and toolbars and hide seperators when they are show up in these unwanted places.
|
Your cpu has too much spare time :-)
------------- Chris (Manchester, UK) -- www.abc6.co.uk ---- Using CodeJock ActiveX Suite 13.1.0 with Windows8, VB6 SP6
|
Posted By: nighthawk
Date Posted: 06 May 2009 at 5:55am
chrisABC wrote:
Your cpu has too much spare time :-)
|
I only need to check the controls when the program does something to
change one of the visibility settings. Looping through a few dozen
controls on such rare occasions is not a problem.
------------- Product: Xtreme SuitePro (ActiveX) version 13.0.0
Platform: Windows XP (32bit) - SP 3
Language: Visual Basic 6.0
|
|