Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Menu item separator without using BeginGroup
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Menu item separator without using BeginGroup

 Post Reply Post Reply
Author
Message
nighthawk View Drop Down
Senior Member
Senior Member
Avatar

Joined: 11 June 2004
Status: Offline
Points: 167
Post Options Post Options   Thanks (0) Thanks(0)   Quote nighthawk Quote  Post ReplyReply Direct Link To This Post Topic: Menu item separator without using BeginGroup
    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.
Back to Top
shipwreck View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 April 2008
Location: United States
Status: Offline
Points: 308
Post Options Post Options   Thanks (0) Thanks(0)   Quote shipwreck Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
nighthawk View Drop Down
Senior Member
Senior Member
Avatar

Joined: 11 June 2004
Status: Offline
Points: 167
Post Options Post Options   Thanks (0) Thanks(0)   Quote nighthawk Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
stefanadelbert View Drop Down
Groupie
Groupie


Joined: 29 October 2008
Location: Australia
Status: Offline
Points: 31
Post Options Post Options   Thanks (0) Thanks(0)   Quote stefanadelbert Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
nighthawk View Drop Down
Senior Member
Senior Member
Avatar

Joined: 11 June 2004
Status: Offline
Points: 167
Post Options Post Options   Thanks (0) Thanks(0)   Quote nighthawk Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
chrisABC View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 June 2008
Status: Offline
Points: 258
Post Options Post Options   Thanks (0) Thanks(0)   Quote chrisABC Quote  Post ReplyReply Direct Link To This Post Posted: 05 May 2009 at 3:27pm
Originally posted by nighthawk 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
Back to Top
nighthawk View Drop Down
Senior Member
Senior Member
Avatar

Joined: 11 June 2004
Status: Offline
Points: 167
Post Options Post Options   Thanks (0) Thanks(0)   Quote nighthawk Quote  Post ReplyReply Direct Link To This Post Posted: 06 May 2009 at 5:55am
Originally posted by chrisABC 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
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.029 seconds.