Should TabbedMdiWindow.Key be Unique?

Docking/MDI for Windows Forms Forum

Posted 14 years ago by Boyd - Automated Software Testing Consultant / Developer, Patterson Consulting, LLC
Avatar
When you create a TabbedMdiWindow (i.e. ToolWindow or DocumentWindow), you assign a Key in the constructor. I haven't seen any exceptions being thrown if I use the same key twice, but I wanted to know if there are any "gotchas" if I don't use unique keys.

For instance, I have multiple DocumentWindows that are created for editing files. I could make the Key of each window be the Filename, but then you run into problems when the name of the file changes (i.e saved as another filename). So far, I've just been giving them all the Key of "EDITOR", and everything appears to be working okay.

So I guess I have two questions...

1) Any problems with non-unique keys?
2) Is it safe (or even possible) to change a key to something else after it's been assigned in the Constructor?

Thanks again!

Comments (2)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
You can use non-unique keys however it is highly recommended that you keep everything unique. This is more for your own functionality because you can use the key-based indexer that way.

Also, you can change the key at run-time when the filenames change.

For document windows, I would recommend using the filename as the key and keeping it up-to-date.


Actipro Software Support

Posted 14 years ago by Boyd - Automated Software Testing Consultant / Developer, Patterson Consulting, LLC
Avatar
Sounds great! I'm glad it's safe to change keys. I knew I'd loose the key-based indexer without unique keys, but it's nice to know I have a lot of options.
The latest build of this product (v2018.1 build 0341) was released 6 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.