By JSW W. - Monday, March 29, 2010
Hello My NdockingToolbar keep changing location after each open/close of VS2008. Normally each try to stay on it own row and would not stay on the same row as I dragged to.
What would be proper way to set location for instance:
top row 1: bar1 + bar2 + bar3 row 2: bar4 + bar5
Left col 1: bar6 + bar7
Bottom row 1: bar8 + bar9
and these stay the same for each open or close VS? Thanks
|
By Angel Chorbadzhiev - Tuesday, March 30, 2010
Hello JSW W., You can save the current state of docking toolbars on exit and load it back when the application starts. Regards, Angel.
|
By JSW W. - Monday, April 19, 2010
Hello
I try the similar to your example, save(), load(). It got strange result such as 1) Some icon images incorrect 2) and then the event did not handle correctly - become dead clicks. 3) the rows are correct but order of commands in the row still not correct as saved.
This test is done during form load. The save is done before exit program.
|
By Angel Chorbadzhiev - Monday, April 19, 2010
Hello JSW W., Can you describe or send us a code snipped how do you set the images of the commands, how do you attach to the event that didn't handle correctly. Also can you check whether the PersistencyFlags property of the manager is set to All. Regards, Angel.
|
By JSW W. - Monday, May 10, 2010
on load m_NCB_State.Manager = m_CmdBarsManager m_NCB_State.PersistencyFlags = NCommandBarsStateFlags.Toolbars 'Dim userCBSfile As String = m_current_path + "\Res\NCB\user.cbs" 'Dim orgCBSfile As String = m_current_path + "\Res\NCB\org.cbs" 'Dim userFile As New FileInfo(userCBSfile) 'Dim orgFile As New FileInfo(orgCBSfile) 'If userFile.Exists Then ' m_NCB_State.Load(userCBSfile) 'Else ' If orgFile.Exists Then ' m_NCB_State.Load(orgCBSfile) ' End If 'End If
on save Dim userCBSfile As String = m_current_path + "\Res\NCB\user.cbs" m_NCB_State.Save(userCBSfile)
I just use these code here. I could not make tool bar stay in it position, also some NComandBar as show wrong icon ids, it seems to attached to different image list.
Nice website update by the way.
What was missing above, pls ignore the commented lines? - since it is yet working so i commented out.
|
By JSW W. - Monday, May 10, 2010
Also i attached icon from design page, it only problem when load state from file.
|
By Angel Chorbadzhiev - Monday, May 10, 2010
Hello JSW W., When the NCommandBarsState saves and loads the toolbars it keeps only the image list of the NCommandBarsManager and not image list of each toolbar. To save and load the images correctly, please set the ImageList of the NCommandBarsManager only and set the ImageIndex of each command to the images of this list. To be able to fire click event of a command after the state was loaded you should be attached to nCommandBarsManager.CommandClicked event instead of attaching to Click event of each command. Regards, Angel.
|
By JSW W. - Tuesday, May 11, 2010
There could be problem for my image List as it set to different transparent colors for each list - also I have a number of images per list so I kind of need them in multiple lists.
Attached all event to nCommandBarsManager.CommandClicked is possible but I have many menus and sub menu so are custom toolbox - there might be some thing i have not oversee.
Are there no alternative to handle the position for each NCB row order and column?
|
By Angel Chorbadzhiev - Tuesday, May 11, 2010
Hello JSW W., To be able to distinguish which command is clicked when NCommandBarsManager.CommandClicked fires you can set and then check the ID property of each command in command bars manager. This approach is demonstrated in Command Bars -> Persistency example from example application provided with installation package. The only way to determine the position is described in this topic http://community.nevron.com/Forum/shwmessage.aspx?ForumID=2&MessageID=3188. Regards, Angel.
|
By JSW W. - Wednesday, May 12, 2010
So is it not possible to use multiple image lists?
My problem is that each image list I set different transparent color. Can I set multiple transparent color in a list?
About the link, I also previously mentioned that the CmdBarsmanger.ToolBars is fix in your editor to sort by alphabet. So I still could not find way to order the toolbars.
In your manager -> toolbars I did not see, how can you reorder the toolbar position.
If this can be solved, then I not have to save and load, all will be working out.
|
By Angel Chorbadzhiev - Thursday, May 13, 2010
Hello JSW W., You can set ImageList to each ToolBar and it will working correctly, but when you save a state of the command bars manager it saves only the imageList that is set to the manager and when load the state back it applies only this ImageList to the toolbars. As I know you cannot set multiple transparent colors in one ImageList. Regarding the toolbars order it is pretty straightforward: To set a toolbar in specific row you need to set its RowIndex property to this row. For example if you want to set toolBar1 to be on the second row you need to do the following: toolbar1.RowIndex = 1; If you have 2 or more toolbars in the same row their order in that row depends of the order that they were added to the manager's ToolBars collection. Let say you have toolBar1 and toolBar2 with the same RowIndex and we want to set toolBar2 to be before toolBar1 that you should do the following: toolbar1.RowIndex = 1; toolbar2.RowIndex = 1; manager.ToolBars.Add(toolbar2); manager.ToolBars.Add(toolbar1); Regards, Angel.
|
By JSW W. - Friday, May 14, 2010
Hi Angel I all working thanks to you. If I added toolbars.clear() before these code, it messed up everything. Strangely it works without having to clear toolbars first.
Cheers
|
|