Print Page | Close Window

ActiveX Version Tutorial?

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=328
Printed Date: 27 September 2024 at 10:54am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: ActiveX Version Tutorial?
Posted By: MikeV
Subject: ActiveX Version Tutorial?
Date Posted: 03 January 2004 at 3:54am

I posted this in the VB section but it doesn't look like it gets a lot of action so I thought I would try here too:

I just purshased the Command Bars activex control based upon the impressive sample projects.  Assuming it would work much like any other activex control I didn't really scrutinize the implementation.  Now that I have the product I find nothing that even remotely would serve as a brief "how-to" for implementation.  Yes there are six sample projects only one with a "xcb" file included.  One of the features I am most interested in is adding XP style tabs to my program, something demonstrated in the "MDI Sample" project, but there isn't a word on how to do in the source code.

I am very impressed by the look of the Command Bar control but I am about ready to write it off unless I can figure it out quickly.  I've poked around and understand the "designer", but without any explanation of what is necessary to achieve a basic menu I find this software very frustrating.  It seems to cater much more to the C++ crowd, which is great, but no help to me.

Can anybody offer a suggestion as to how to get up and running with the ActiveX version of Command Bar?

 




Replies:
Posted By: SuperMario
Date Posted: 15 February 2004 at 12:46am
To add a tabbed workspace is really easy, add these two lines of code to the Form_Load of your main application after the command bar is loaded or created via code: 
    Dim Workspace As ITabworkspace
    Set Workspace = CommandBars.ShowTabWorkspace(True)
Remember, this will only work in a MDI application.

As far as a how to , it depends on your preference.  Do you want to use the designer to create your command bar, or create it via code?

To create a command bar with the designer is very simple (Reffering to the customizable example).  First design your command bar in the designer and click on the CommandBars menu selection then click the Recource Symbols selection.  Click the Import button and it will create a recource .bas file you need to include in your VB application.  This file contains the control IDs that will be used to associate the icons with controls and you use these IDs in your code.  To load your .xcb file created in the designer add this code to your Form_Load:
    CommandBars.LoadDesignerBars App.Path & "\filename.xcb"

That's all you have to do to load the command bar, there are a few more lines of code if you want to actually save the command bar if it was customized.  After that you have to add code to the CommandBars_Execute and CommandBars_Update event procedures.  Both of the event procedures will contain a "Select Case" structure.  Both of these event procedures will be passed a  ICommandBarControl object called Control.  You can get the ID of the control that was clicked from this object.  So you use the "Select Case" structure to test "Control.Id" against all of the IDs that were generated in the .bas module that was exported from the designer.  Once you find the correct ID you can perform the appropriate action.  The CommandBars_Execute event procedure is used when you need to perform a task like open a dialog or hide a toolbar.  The CommandBars_Update event procedure is used for things like placing the check mark next to the control name in the menu if it is visible.  Or keeping a control diabled while a condition exists, like keeping the paste buttin disabled if nothing is in the clipboard.  The Update procedure is called automatically, where the Execute procedure is called when a control is clicked. 

Well, I hope this helped you understand the Customizable sample.  Let me know if you would like another example explained.



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