Neoteny Posted June 29, 2007 Report Share Posted June 29, 2007 First problem: when I capture the InternalCommand event to see if the user changes the Gallery via a context menu, I don't know the constants for the change of the gallery of one series (i.e. when changing the gallery for the chart to area the args.id is CommandID_Area, but what is the args.id when changing the gallery for one series) Second problem: I changed the subCommands of the Gallery command (removed several chart types and added a new one, created using Commands.AddCommand). When I select this command using the context menu or hte toolbar, I expect the UserCommand to be raised (since I selected a command I created myself), but instead an InternalCommand event is raised and the args.ID makes no sence to me (it isn't the ID I gave my command) Furthermore, debugging is hell because my application keeps crashing when I make coding errors adding commands to context menus (addressing non-existent indices for instance) or changing data for the chart. I know it's caused by my stupidity, but it would have have been nice to get a normal error and be able to debug the error in a normal way. Instead the application is terminated and I have to start Visual Studio again I'm using VB6 and the chartFX control is used inside a UserControl. I'm using the latest release of Chart FX Client Server 6.2 (downloaded the service pack from this website) Hope you can help out (especially with the first two problems) Regards, Caius Caesar Link to comment Share on other sites More sharing options...
Frank Posted June 30, 2007 Report Share Posted June 30, 2007 > First problem: when I capture the InternalCommand event to see if the user changes the Gallery via a context menu, ... The gallery command always has the same id, regardless of context. As part of the command parameters you also receive an object that indicates the context. In the case of the Gallery command from the toolbar or chart's background, this object will be null (or a Pane). In the case of the series gallery it will be the series object, > Second problem: I changed the subCommands of the Gallery command ... The gallery command is a selector, meaning that it selects from a fixed number of options. The ID you receive is always the id for CommandId.Gallery. In the event parameter you will find a property called SubCommandId that will give you which sub-option was selected (index). > Furthermore, debugging is hell because my application keeps I don't understand this one. Passing indexes out of bounds can definitely crash your app. Because you are working with unmanaged controls (COM) it is not uncommon that crashes in your code or in the control will crash the entire app. Link to comment Share on other sites More sharing options...
Neoteny Posted July 2, 2007 Author Report Share Posted July 2, 2007 Thanks for the quick reply, > As part of the command parameters you also receive an object that indicates the context. In the case of the Gallery command from the toolbar or chart's background, this object will be null (or a Pane). In the case of the series gallery it will be the series object, It seems to me you're talking about another version of the component (.NET?). The InternalCommand event has two arguments: sender (which always contains the chart control) and args As Cfx62ClientServerCtl.CommandUIEventArgs. Now, I discovered that Args.HitType gives me the type of the chart-part that was clicked in an enumeration, but I'm still having problems discovering which gallery type is selected (especially when I've added one myself). I don't find a SubCommandId in the event parameter and I can't decypher the logic behind the ID that is passed in args.ID. args.Object is always empty and args.Handled doesn't help me either. There's nothing in the help (reference and samples) that could enlighten me. As far as I can see this single ID must contain all other information: Which series (if applicable) Which CommandID ... I would very much like some information about this... > I don't understand this one. Passing indexes out of bounds can definitely crash your app. Because you are working with unmanaged controls (COM) Lol, back in the old days when COM was the only way to go it would have been VERY bad for business if a commercially sold control would crash when an index out of bounds was passed to it. Now you simply call it 'unmanaged'. I guess that times have changed. Never mind though, we're a bit late moving to .NET and now have to bear the consequences. Regards, Caius Caesar Scanmar Link to comment Share on other sites More sharing options...
Frank Posted July 2, 2007 Report Share Posted July 2, 2007 > It seems to me you're talking about another version of the component (.NET?). args is what I was referring to as the parameter. I was looking at a different version and while args.Object exist in 6.2, args.SubCommandId does not. In 6.2, the CommandId for a selector command will be : First Command In Selector Id + Option Index In the case of the gallery command it will be CommandId.Line (or whatever gallery is the first in the list of sub commands if you customize it) plus the index of the sub command. > args.Object is always empty and args.Handled doesn't help me either You mean args.Object is null? This is not what I get on my end. I get a different object when I click on a series than when I click in the chart background. Link to comment Share on other sites More sharing options...
Neoteny Posted July 3, 2007 Author Report Share Posted July 3, 2007 I puzzled a while and got most things working, but not the way you describe it: First: args.object is always empty in my version Second: I found that args.ID gives very interesting results! Before making changes to the contents of the submenu, clicking a chart type returns the appropriate CommandID in args.ID (so clicking a Line chart gives args.ID=CommandId_Line, clicking a bar gives args.ID=CommandId_Bar, etc...). But After I change the Gallery options like this With Chart1.Commands(CommandID_Gallery) .RemoveAllSubCommands .InsertSubCommands 2, 0 .SubCommandID(0) = CommandID_Line .SubCommandID(1) = CommandID_Bar End With The args.ID returns a different number. After a while I found out that it is CommandID_Gallery + CommandID_Line (when clicking the line chart) Or CommandID_Gallery + CommandID_Bar (when clicking the bar chart) If I add a self-defined Command this logic works too (CommandID_Gallery + MyId). After I found this out I was able to do most things I want. I still don't know how to find out which series, axis or other object is clicked though. Regards Caius Link to comment Share on other sites More sharing options...
Frank Posted July 13, 2007 Report Share Posted July 13, 2007 How about args.Object? Link to comment Share on other sites More sharing options...
Neoteny Posted July 17, 2007 Author Report Share Posted July 17, 2007 As I wrote in my last posting: 'First: args.object is always empty in my version' Link to comment Share on other sites More sharing options...
JuanC Posted July 19, 2007 Report Share Posted July 19, 2007 We have a new build where args.object will have a non-null value for the specific commands that apply to a series or a specific point. Normally this will be the case when HitType = HitType_Point (3) so I wrote a little VB sample that does the following Private Sub Chart1_InternalCommand(ByVal sender As Object, ByVal args As Cfx62ClientServerCtl.CommandUIEventArgs) If ((args.HitType = HitType_Point) And Not (args.Object Is Nothing)) Then Debug.Print "Internal Command on series " + CStr(args.Object.Series) End If End Sub Please send a message to support at softwarefx dot com and include a pointer to this thread and we will send you an interim build with this functionality, this will be included in our next service pack. JuanC Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.