User (Legacy) Posted July 14, 2004 Report Share Posted July 14, 2004 I have a annotation toolbar which has been modified with a custom command. eg. //Customize the annotation toolbar int pasteImageCommandID2 = (int)CommandID.Last + 2000; pasteImageCommand2 = annotx.Commands.AddCommand(pasteImageCommandID2); pasteImageCommand2.Text = "Paste"; pasteImageCommand2.Picture = 19; int idx = 0; annotx.ToolBarObj.InsertAt(idx); annotx.ToolBarObj[idx] = pasteImageCommandID2; ... If I export extensions and then import them again, I have several problems. First, the annotation toolbar loads but my custom command is missing. This requires me to add my customizations back in to the toolbar which is not really a big deal. //Export chart1.FileMask = FileMask.Extensions; chart1.Export(FileFormat.XML, filePath); ... //Then Import some time after chart1.Import(FileFormat.XML, filePath); ....... The second problem is the Toolbars menu command is missing from the Background context menu even though the toolbar is displayed. Instead of seeing Toolbars->Toolbar and Toolbars->Annotation Toolbar, all I see is the Toolbar command and no command for the Annotation toolbar. I tried saving the subcommands before the import and restoring them after, but the restored Annotation Toolbar command checkmark is out of sync with the displayed toolbar. Removing the checkmark from the Annotation Toolbar submenu actually displays a second toolbar. I also tried using FileMask.All for the export but with similar results. Is there any way to restore the Toolbars menu and the subitems to their correct state? It would also be nice to be able to export the annotation objects independently of the toolbar. This way, I wouldn't need to mess with the toolbar at all when all I really want is the annotation objects. Link to comment Share on other sites More sharing options...
Software FX Posted July 14, 2004 Report Share Posted July 14, 2004 Assigning: chart1.FileMask = FileMask.Extensions Is REMOVING all other flags, including FileMask.Tools (used to save toolbar information). Maybe you meant to do: chart1.FileMask |= FileMask.Extensions; -- FP Software FX Link to comment Share on other sites More sharing options...
User (Legacy) Posted July 15, 2004 Author Report Share Posted July 15, 2004 Actually, all I really want to persists are the annotation objects, so it seems like chart1.FileMask = FileMask.Extensions is correct. The problem is that even though I'm importing only extensions, my annotation toolbar changes and I can't get it back to its original state. I tried or-ing in the FileMask.Tools option to see if I could save and import the annotation toolbar along with the extensions but the customization is gone on import. It is not clear from the documentation whether the FileMask.Tools applies to the standard toolbar, the annotation toolbar, or both. Does the annotation toolbar (As opposed to the standard toolbar) belong to FileMask.Extensions or to FileMask.Tools? Perhaps you could clarify. Link to comment Share on other sites More sharing options...
Software FX Posted July 15, 2004 Report Share Posted July 15, 2004 It is both. You need both Tools and Extensions to save customizations to the annotation toolbar. I tested the following: annotX.Commands.AddCommand(1); annotX.Commands[1].Text = "Custom Command"; annotX.ToolBarObj.InsertAt(0); annotX.ToolBarObj[0] = 1; chart1.FileMask = FileMask.Tools | FileMask.Extensions; chart1.Export(FileFormat.Binary,fileName); Later, I imported this file into a brand new chart and I can see the custom button. Are you doing the same ? if you are I'm going to need a repro case. -- FP Software FX Link to comment Share on other sites More sharing options...
User (Legacy) Posted July 15, 2004 Author Report Share Posted July 15, 2004 Repro case attached. Hit Save button. When you hit load button, the custom button disappears. Link to comment Share on other sites More sharing options...
Software FX Posted July 15, 2004 Report Share Posted July 15, 2004 The problem: FileFormat.XML Toolbar customizations are not saved in XML's as it may require binary information (pictures). -- FP Software FX ChartFx Annotation Test.zip Link to comment Share on other sites More sharing options...
User (Legacy) Posted July 15, 2004 Author Report Share Posted July 15, 2004 Thanks for the help. Are there any ramifications for using the Binary FileFormat? Will future versions of ChartFX be able to read these? I'm wondering about all the export flags and not just annotations. Link to comment Share on other sites More sharing options...
Software FX Posted July 15, 2004 Report Share Posted July 15, 2004 Binary files are compatible across Service Packs. New versions may require to significantly change the format, but this is also true about the XML format. If this is the case, filters will be provided to read old files into new versions. -- FP Software FX Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.