Alternatives to Designer Studio
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=1522
Printed Date: 27 November 2024 at 2:08am Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Alternatives to Designer Studio
Posted By: DDJJ
Subject: Alternatives to Designer Studio
Date Posted: 13 December 2004 at 4:54pm
I am in the process of testing the codejock ActiveX controls for use in our VB6 app. What are the alternatives to using the Designer Studio, if any (besides creating your menus/toolbars from scratch in code)?
Is there a way to create your controls using Designer Studio, then kick out the VB6 code necessary to create them? I'm not sure we want to load a series of *.xcb files every time our users start the program and, like most, I guess I'd rather see the visual elements done in code.
Is it safe to use more than one CommandBar control per form in VB6? I seem to be getting some unstable results when I try this.
What is the recommended way to enable/disable toolbar controls? I've been trying to disable one control for the better part of a day, without any luck. The controls are loaded using the LoadDesignerBars method.
I love the appearance of the codejock menus/toolbars although I think it's fair to say here that finding answers using the provided help files, tutorials, etc. has been difficult, to say the least.
Thanks for any help here!
Dan
|
Replies:
Posted By: Boyd
Date Posted: 13 December 2004 at 6:53pm
The Designer Studio is nice, but there's no feature to export your design to the corresponding VB code. This would be a nice feature request to submit.
Like you, I didn't want to manage all those XCB files, so I just create all my menus in code. It's not as bad as you might think. You may want to use the Designer Studio to help you "plan" your menu system. After that, the code is pretty easy to create.
I've never tried using more than one CommandBars instance on a single form, but I have used multiple instances on different forms within the same application (no problems there). Typically, you can create multiple toolbars or popup menus that are all hosted from the same CommandBars instance.
The intended way to enable/disable controls is in the 'Update' event for CommandBars. This event is fired to update a command before it is displayed or accessed (or periodically fired for toolbar controls that are always displayed).
As for getting help, the best resource will be the sample projects. If you have questions that can't be answered by the supplied documentation or projects, just post your questions here. Codejock monitors these forums pretty closely and will typically give you feedback in a reasonable amount of time.
|
Posted By: DDJJ
Date Posted: 14 December 2004 at 8:32am
Thanks for your reply.
I agree, creating the menus in code isn't so bad.
Not sure I understand ImageManager. I've read elsewhere here that I can load our icons into ImageManager programatically. Does this mean that after loading them, I don't need to do it again? What I'm picturing is a control that stores the images for later retrieval when starting the app. I don't need to load them every time I start the app do I? Again, I've looked, but can't find any documentation about how to use ImageManager. One of the samples (can't remember the name) uses an ImageList, but not sure that's the right way to go. Since I'm at the beginning of this process, please point me in the right direction here...
|
Posted By: SuperMario
Date Posted: 14 December 2004 at 10:41am
If you load them with the UI then you won't have to add them again, If
you add them via code then you must include the image files with your
app as they aren't compiled in the exe.
|
Posted By: DDJJ
Date Posted: 15 December 2004 at 10:25am
Can you recommend one or more provided samples or tutorials which will give me a good idea about how to go about adding icons by code, including how to deal with hot and disabled icons?
|
Posted By: SuperMario
Date Posted: 15 December 2004 at 10:36am
The CommandBar Icon sample illustrates how to add icons using the
UI. You will need to look at the tutorial for this sample to see
how this is done.
The short verion:
Both hot and disabled icons (and "checked" icons in next verion) are
created automatically when you add icons to the ImageManage (both by
code and throught the UI). So you only need to add a hot or
disabled icon if you want to use a custom icon when the control is
disabled or hot.
Take a look at the Outlook 2003 sample, this sample illustrates how to
load images via code. In the sample, all the icons are stored in
a bitmap file and loaded at the same time.
Then I have posed on this topic before in the forums:
https://forum.codejock.com/forum_posts.asp?TID=763& ;KW=imagemanager
|
Posted By: DDJJ
Date Posted: 15 December 2004 at 10:55am
Thanks! Let me play with this a bit...
|
Posted By: DDJJ
Date Posted: 16 December 2004 at 12:27am
After a few hit and misses, I was able to load icons fairly easily. Using an existing resource file to store the image works fine (and also avoids have to reload/duplicate).
I continue to have a problem briefly mentioned earlier:
We have a VB6 form which hosts a fairly complex series of multiple tabs/sub tabs, etc. I am using the codejock tabcontrol for this purpose. A few of these different tabs require a control to help the user navigate through some database records. Because I can't figure out how you would create say, 6 different toolbars from one instance of the CommandBar instance AND have each toolbar show up on a different tab, I have instead tried dropping the CommandBar control in six different picturebox controls to see if I could make that work.
Three times now I have done this and closed the code thinking that it was working. When I've later gone back to reopen the code however, VB crashes when I merely try and open the form to view it (something about "could not read memory...). I'm guessing that it doesn't like the fact that I'm using 6 different CommandBar controls on the same form.
Is it possible to do what I wanted to do to begin with, which is add one CommandBar control and programatically create 6 toolbars which will be resident on six different picturebox controls? This would obviously be the right way to go, and avoid having to even deal with the crashes I'm having doing it the way I am now. Seems like the CommandBar control would need an "Owner" property (which I don't seem to be able to find), or something like that, for each CommandBarControl object created to associate 6 different picturebox controls??
Thanks!
|
Posted By: Oleg
Date Posted: 16 December 2004 at 5:44am
you can't. you must create 6 CommandBars objects for each PictureBox and place them on PictureBox (not Frame)
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
Posted By: DDJJ
Date Posted: 16 December 2004 at 9:23am
That's the problem. I have created 6 different CommandBar objects for the form, and placed each of those CommandBar objects in separate PictureBox controls. You're saying this should work? Then why is the form crashing every time I try and start it?
Is there any thread out there, or other codejock documentation, that covers this in any detail? I was going to try creating 6 additional borderless forms today, dropping the CommandBar control on each new form, and pointing the OLE_HANDLE of the tabs to these new forms to see if that would work. That seems like a rather inefficient way to have to do it though...
Thanks for the responses! I gotta say the codejock forum has been great for response times.
|
Posted By: SuperMario
Date Posted: 16 December 2004 at 9:35am
Try placing the PictureBox on the form, then insert the CommandBars object directly into the PictureBox.
|
Posted By: DDJJ
Date Posted: 16 December 2004 at 10:01am
That's what I've been doing. Actually, I've set this up so that each codejock tab points to a PictureBox control as the OLE_HANDLE, then inserted a PictureBox control within THAT PictureBox control, then inserted a CommandBar control within THAT PictureBox control. Make sense?
Also, I am assuming there is no way to use one CommandBar control and programatically create each CommandBarControl and "assign" them to a PictureBox control, correct?
|
Posted By: SuperMario
Date Posted: 16 December 2004 at 10:05am
I have no problems doing this. Can you post sample for us to debug? And yes, you are correct on last question.
|
Posted By: DDJJ
Date Posted: 16 December 2004 at 10:15am
Hold on. I just noticed that at least one of the controls hosting a CommandBar control is in fact a Frame control. Sounds like this is a big no no, so I'm going to change this and see if that fixes the problem. Will report results.
Thanks!
|
Posted By: DDJJ
Date Posted: 16 December 2004 at 12:09pm
OK. I think we're getting closer here...
Changed all of the frame controls to PictureBox controls. Reran code, same problem.
Deleted all of the CommandBar controls by editing the VB form using Notepad. Opened up the form in the IDE, added the controls back in, BUT I commented out the following (and it works!):
CommandBars1.LoadDesignerBars App.Path & "\BasicNavigation.xcb" CommandBars2.LoadDesignerBars App.Path & "\BasicNavigation.xcb"
For i = 0 To 4 CommandBars3(i).LoadDesignerBars App.Path & "\MinorNavigation.xcb" CommandBars3(i)(2).ContextMenuPresen t = False
Next CommandBars4.LoadDesignerBars App.Path & "\MinorNavigation.xcb" CommandBars4(1).ContextMenuPresent = False
As long as I don't load the designer bars, I am able to save, close, and reopen the app without a problem. This is not a big issue because I am in the process of using code to design the CBs, so this language will be deleted anyway. But I think the problem has been either (1) you can't load the same designer info to more than one CB at the same time, or (2) I'm doing something wrong with the ContextMenuPresent property.
Am I heading in the right direction?
|
Posted By: SuperMario
Date Posted: 16 December 2004 at 12:23pm
I think this is wrong, here it looks like you are trying to load an xcb
file into all 4 commandbars in the CommandBars3 object (not sure what
you are doing here).
DDJJ wrote:
For i = 0 To 4
CommandBars3(i).LoadDesignerBars App.Path & "\MinorNavigation.xcb"
CommandBars3(i)(2).ContextMenuPresen t = False
Next
|
To access a particular commandbar in a CommandBars object do this:
CommandBars(1).ContextMenuPresent = FALSE ' This is the ActiveMenuBar
CommandBars(2).ContextMenuPresent = FALSE ' This is the First CommandBar added
CommandBars(3).ContextMenuPresent = FALSE ' This is the Second CommandBar added
......
Why not just?:
CommandBars3.LoadDesignerBars App.Path & "\MinorNavigation.xcb"
CommandBars3(2).ContextMenuPresen t = False
This will remove the context menu entry for the 1st toolbar added in the MinorNavigation xcb file.
I think you meant this:
CommandBars3.LoadDesignerBars App.Path & "\MinorNavigation.xcb"
For i = 1 To 5
CommandBars3(i).ContextMenuPresen t = False
Next
|
Posted By: DDJJ
Date Posted: 16 December 2004 at 2:14pm
I see what your are saying SuperMario, and this may have been one of the problems I was having. Since adding the controls programatically however, the problem has gone away. I guess this means I should stick to doing things in code rather than the xcb.
To all who have responded to this thread, please accept my thanks. Your replies made it a LOT easier to identify the problems I was having!
|
|