TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
-
whatever
- Newbie
- Posts: 3
- Joined: Thu Mar 09, 2006 12:00 am
Post
by whatever » Wed May 31, 2006 3:38 pm
Hello,
On a base form I have put an Editor:
Code: Select all
private Steema.TeeChart.Editor editor1;
On inherited Forms I want to assign the Editor when a contextMenu is popped up which I do by writing:
Code: Select all
private void contextMenuChart_Popup(object sender, System.EventArgs e)
{
m_ContextChart = (Steema.TeeChart.TChart) ((System.Windows.Forms.ContextMenu) sender).SourceControl;
}
then when the context menu item is clicked I want to show the editor. I try this:
Code: Select all
editor1.Chart = m_ContextChart;
editor1.ShowModal();
But I get the following exception:
Object reference not set to an instance of an object.
Stack Trace: at Steema.TeeChart.Editors.ChartEditor..ctor(Chart c)
at Steema.TeeChart.Editor.ShowModal(Control owner)
at Steema.TeeChart.Editor.ShowModal()
at SWS_Data_Enhancer.Forms.FormChildStd.mnuChartEditor_Click(Object sender, EventArgs e) in c:\dev\c#\client apps\sws data enhancer\forms\formchildstd.cs:line 177
at System.Windows.Forms.MenuItem.OnClick(EventArgs e)
at System.Windows.Forms.MenuItemData.Execute()
at System.Windows.Forms.Command.Invoke()
at System.Windows.Forms.Command.DispatchID(Int32 id)
at System.Windows.Forms.Control.WmCommand(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
Can anyone help please?
I use VS2003.
thanks.
-
Narcís
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Thu Jun 01, 2006 10:46 am
Hi whatever,
The problem may be related to having the editor declared as private, to be visible from an inherited form you should declare it as protected.
I'm also going to send you, to your forums contact e-mail, a working example.
-
whatever
- Newbie
- Posts: 3
- Joined: Thu Mar 09, 2006 12:00 am
Post
by whatever » Thu Jun 01, 2006 11:01 am
Thank you for your reply but the Editor should be private (I tried protected and it does not change anything).
All the code I wrote is in the base form so that there is no need to duplicate the call to editor.ShowModal() in inherited forms. I simply need to assign the ContextMenu at design time for the charts requiring the editor facility and the job is done (standard oop design principle).
I will try to update the chart with a newer version and let you know if that solves anything.
Thanks
-
whatever
- Newbie
- Posts: 3
- Joined: Thu Mar 09, 2006 12:00 am
Post
by whatever » Thu Jun 01, 2006 12:02 pm
Thanks.