Print Page | Close Window

How to hide buttons at start-up?

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=522
Printed Date: 29 April 2024 at 9:00am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to hide buttons at start-up?
Posted By: tanyakut
Subject: How to hide buttons at start-up?
Date Posted: 12 March 2004 at 12:48pm

I want to make sure that some buttons will not show up in the toolbar when user starts application for the first time but rather be an option in the "customization" menu.How can I achieve that?
   I have 20-30 buttons available for user and only 5-7 of them will be required. How  can I make sure that all these 30 buttons will not come up on the screen?

 P.S. Thanks for the help!!

 




Replies:
Posted By: SuperMario
Date Posted: 12 March 2004 at 1:12pm
If you are using a CommandBar  created in designer studio all you have to do is add all of the controls to the "Controls" window in the upper right corner.  Just drag all unwanted controls into the "Controls" window and they will be added to the "customization" menu.

If you creating the CommandBar via code you can do something similar in the next relese.  You would add all of the controls to the DesignerControls property (done in a CommandBar event called Customization) that would be displayed in the Customization menu.  Then you would only add the buttons needed at startup to the CommandBar.  With the current release the "Customization" menu is not functional with a CommandBar created via code.  So you would have to add all of the controls to the toolbar and  change the "Visible" property to true or false.  Below is an example that adds the "File" activemenubar control and has 2 controls not visible.

 Dim Control As CommandBarControl
   
    Set ControlFile = CommandBars.ActiveMenuBar.Controls.Add(xtpControlPopup, 0, "&File", -1,     False)

    With ControlFile.CommandBar.Controls
        Set Control = .Add(xtpControlButton, ID_FILE_NEW, "&New", -1, False)
       
        Set Control = .Add(xtpControlButton, ID_FILE_OPEN, "&Open", -1, False)
        Control.Visible = False

       .Add xtpControlButton, ID_FILE_SAVE, "&Save", -1, False

        Set Control =.Add( xtpControlButton, ID_FILE_CLOSE, "&Close", -1, False)
        Control.Visible = False
       
        Set Control = .Add(xtpControlButton, ID_FILE_PRINT, "&Print", -1, False)
    End With

Hope this helps.


Posted By: robs
Date Posted: 12 March 2004 at 1:13pm

I have only tried this with buttons added through code and not the designer:

Set the .visible property to false when adding the control.

When dragging the tool from the customize menu, it sets the .visible property to true.

 



Posted By: robs
Date Posted: 12 March 2004 at 1:18pm

SuperMario is right. I forgot that in the current release, controls added throgh code don't show up in the customize menu. The next release handles this very well.

 



Posted By: tanyakut
Date Posted: 12 March 2004 at 3:01pm

Thanks a lot for your help.  Another question for you!

I am using designer. When I ran application I used "customize" option and dragged 5 controls to the toolbar window. They showed up. I was so happy! But later I could not get rid of them.. The only option was to use "RESET" button... What if I wanted to remove only one button? Why the control and its "check/uncheck" buttons are  disabled?



Posted By: robs
Date Posted: 12 March 2004 at 3:07pm

You should be able to remove one button at a time by dragging the control off the toolbar into the application work area while in 'customize' mode.

I don't know why the check/uncheck buttons are disabled, but this is normal behaviour. It was maybe just a judgement call by CodeJock?

 



Posted By: tanyakut
Date Posted: 12 March 2004 at 3:16pm
You are right! It worked...But I am afraid that this toolbar is too advanced for my users. If it was not very clear for me what to do, I am afraid they would be so irritated!  It is a great toolbar but it requires help not only for the developers but for the users as well. 


Posted By: robs
Date Posted: 12 March 2004 at 3:30pm

With great power comes great responsibility!

At least you have options. If you think it's too complicated for your users, then maybe don't allow them to customize.

In our case, we are only allowing system administrators to customize.

Also, although there is no official standard, the adding and removing of buttons with the codejock stuff acts pretty much like any other toolbar (vb, word, etc.)

Glad you got it working.

 



Posted By: tanyakut
Date Posted: 12 March 2004 at 4:01pm
Have you ever used  "AddHiddenCommand" method?  


Posted By: SuperMario
Date Posted: 12 March 2004 at 4:26pm
The "AddHiddenCommand" marks a control a used infrequently.  This makes the control not be displayed in the active menu bar popups until the arrow button is clicked to display all controls, both frequent and non-frequent.  This works just like the Windows XP start menu, it hides all programs that have not been used in a long time, then you need to hit the arrow button to display all programs.


Posted By: tanyakut
Date Posted: 12 March 2004 at 5:00pm
Thanks you!!! What would I do without you ?



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