Jump to content
Software FX Community

Custom Toolbar Selector command crash


Pete

Recommended Posts

I'm probably missing something here, but I'm not sure what it is.  I'm trying to have a 3-state toolbar item where the selected item icon displays in the toolbar, much like the Gallery toolbar item.  Code follows, and the exception generated when selecting one of the subcommands follows that.  Without the CommandStyles.Selector and CommandStyles.ChildImage styles, the code works correctly (though it doesn't display the selected image).

 ---------------------------------

CommandCollection commands = this.Chart1.Commands;Command command = new Command(20);

commands.Add(command);

command.ImageIndex = 15;

command.Style = CommandStyles.SmartList | CommandStyles.Selector | CommandStyles.ChildImage;

command.Text =

"Selector";command.Enabled = true;Command subcommand = new Command(21);

commands.Add(subcommand);

subcommand.ImageIndex = 16;

subcommand.Style = CommandStyles.SelectorChild;

subcommand.Text =

"First";subcommand.Enabled = true;

command.SubCommands.Add(subcommand.ID);

subcommand = new Command(22);

commands.Add(subcommand);

subcommand.ImageIndex = 17;

subcommand.Style = CommandStyles.SelectorChild;

subcommand.Text =

"Second";subcommand.Enabled = true;

command.SubCommands.Add(subcommand.ID);

subcommand = new Command(23);

commands.Add(subcommand);

subcommand.ImageIndex = 18;

subcommand.Style = CommandStyles.SelectorChild;

subcommand.Text =

"Third";subcommand.Enabled = true;

command.SubCommands.Add(subcommand.ID);

this.Chart1.ToolBar.Insert(this.Chart1.ToolBar.Length, new ToolBarItem(command.ID));

 ---------------------------------

See the end of this message for details on invoking

just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************

System.NullReferenceException: Object reference not set to an instance of an object.

at ChartFX.NetIEClient.CommandCollection.b(Object A_0, Int32 A_1, ICommand A_2, Int32& A_3)

at ChartFX.NetIEClient.CommandCollection.a(Object A_0, Int32 A_1, ICommand A_2, Boolean A_3, IUIObject A_4)

at ChartFX.NetIEClient.c.a(EventArgs A_0)

at System.Windows.Forms.MenuItem.MenuItemData.Execute()

at System.Windows.Forms.Command.Invoke()

at System.Windows.Forms.Control.WmCommand(Message& m)

at System.Windows.Forms.Control.WndProc(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************

mscorlib

  Assembly Version: 2.0.0.0

  Win32 Version: 2.0.50727.42 (RTM.050727-4200)

  CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll

----------------------------------------

System

  Assembly Version: 2.0.0.0

  Win32 Version: 2.0.50727.42 (RTM.050727-4200)

  CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll

----------------------------------------

ChartFX.NetIEClient.Loader

  Assembly Version: 7.0.1500.0

  Win32 Version: n/a

  CodeBase: http://localhost:4758/Chart%20FX%20Test/chartfx70/download/ChartFX.NetIEClient.Loader.dll

----------------------------------------

System.Windows.Forms

  Assembly Version: 2.0.0.0

  Win32 Version: 2.0.50727.42 (RTM.050727-4200)

  CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

----------------------------------------

System.Drawing

  Assembly Version: 2.0.0.0

  Win32 Version: 2.0.50727.42 (RTM.050727-4200)

  CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

----------------------------------------

Accessibility

  Assembly Version: 2.0.0.0

  Win32 Version: 2.0.50727.42 (RTM.050727-4200)

  CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll

----------------------------------------

Microsoft.mshtml

  Assembly Version: 7.0.3300.0

  Win32 Version: 7.0.3300.0

  CodeBase: file:///C:/WINDOWS/assembly/GAC/Microsoft.mshtml/7.0.3300.0__b03f5f7f11d50a3a/Microsoft.mshtml.dll

----------------------------------------

ChartFX.NetIEClient

  Assembly Version: 7.0.2664.18534

  Win32 Version: n/a

  CodeBase: http://localhost:4758/Chart%20FX%20Test/chartfx70/download/ChartFX.NetIEClient.dll

----------------------------------------

ChartFX.NetIEClient.Base

  Assembly Version: 7.0.2664.18353

  Win32 Version: n/a

  CodeBase: http://localhost:4758/Chart%20FX%20Test/chartfx70/download/ChartFX.NetIEClient.Base.DLL

----------------------------------------

ChartFX.NetIEClient.Adornments

  Assembly Version: 7.0.2664.18381

  Win32 Version: n/a

  CodeBase: http://localhost:4758/Chart%20FX%20Test/chartfx70/download/ChartFX.NetIEClient.Adornments.DLL

----------------------------------------

System.Configuration

  Assembly Version: 2.0.0.0

  Win32 Version: 2.0.50727.42 (RTM.050727-4200)

  CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

----------------------------------------

System.Xml

  Assembly Version: 2.0.0.0

  Win32 Version: 2.0.50727.42 (RTM.050727-4200)

  CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll

----------------------------------------

ChartFX.NetIEClient.Annotation

  Assembly Version: 7.0.2664.18782

  Win32 Version: n/a

  CodeBase: http://localhost:4758/Chart%20FX%20Test/chartfx70/download/ChartFX.NetIEClient.Annotation.DLL

----------------------------------------

************** JIT Debugging **************

To enable just-in-time (JIT) debugging, the .config file for this

application or computer (machine.config) must have the

jitDebugging value set in the system.windows.forms section.

The application must also be compiled with debugging

enabled.

For example:

<configuration>

  <system.windows.forms jitDebugging="true" />

</configuration>

When JIT debugging is enabled, any unhandled exception

will be sent to the JIT debugger registered on the computer

rather than be handled by this dialog box.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...