NDockingToolbar persistence


Author
Message
Craig Swearingen
Craig Swearingen
Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)
Group: Forum Members
Posts: 99, Visits: 654

I've been using NDockingToolbars just fine but I've disabled letting the user move them around til now.  I've turned on the properties to allow the toolbars to be moved around and that operation works as expected.  I've been trying to persist the toolbar location for several hours now and can't make it work reasonably.

I build my toolbars (1 MenuBar and 2 icon bars) mostly dynamically by adding an NCommand to my NDockingToolbar Commands collection.  Works great. 

I briefly tried using the NCommandBarsState class to save my toolbars state.  When I loaded a saved state my click events on my commands were unknown.  I gave up at that point.  I would imagine the way I build my toolbars is not compatible with this persisting approach. 

Thus I'm trying to persist the toolbar Dock, Location, and RowIndex properties.  I don't allow the user to edit the toolbars themselves so I was hoping that would be sufficient to remember and it nearly is.

1) When calling toolbar.Dock = DockStyle.None my toolbar properly floats out from the docked position.  If I then call toolbar.Dock = DockStyle.Top the toolbar docks back at the top but its height is wrong and it continues to show parts of the floated toolbar visual.  I've tried setting the above properties in different orders and using the NCommandBarsManager Suspend/ResumeDockLayout methods as well as setting the FloatingSize/Location to 0 but nothing helps.  Works great when the user docks using the mouse.  What else can I do programatically to get the visual to look the same?  (I attached a scribbled out picture of this docked toolbar visual issue.)

2) I read on this forum that the ability to move a toolbar above the menu bar (which is a toolbar too) is by design.  Someone has already asked if there was a way to stop this.  I can't think of a single application that has allowed me to move my toolbars above a menu bar.  This should be optional.  I briefly tried persisting my menubar as a toolbar too so as to accomodate the user doing this and began getting some form of exception (not in my code).  I did not persue this further.

3) I tried setting CanFloat to false.  When doing this the user can't move the toolbar to any other dock state.  I was hoping they could move it around the borders but it seems its stuck.  Anyway to not support float but move around all borders?

I'm running on Win7 using build 11.12.14.12.  I would appreciate any suggestions on the proper persisting of toolbars and recommendations on these issues I've seen.


Attachments
dockedtoolbarvisual.GIF (404 views, 8.00 KB)
Reply
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hello Craig,

I will try to give you an answers to your questions:

"When I loaded a saved state my click events on my commands were unknown" - Docking toolbar framework does not persist the events. After the state was restored you should attach to the desired events again.

" If I then call toolbar.Dock = DockStyle.Top the toolbar docks back at the top but its height is wrong and it continues to show parts of the floated toolbar visual." - This is a bug which will be fixed in the next release.

"I can't think of a single application that has allowed me to move my toolbars above a menu bar." - Visual Studio 2008 .

" I briefly tried persisting my menubar as a toolbar too so as to accomodate the user doing this and began getting some form of exception (not in my code). " - Could you post the exception message so we can investigate what cause it.

"I tried setting CanFloat to false. When doing this the user can't move the toolbar to any other dock state." - To change the docking location of a toolbar it first becomes floating, and then becomes docked on the new location. That's why you cannot change the docking position when CanFloat is false.

Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search