Page 1 of 1

Is there a way to lightly customize the tchart export dialog

Posted: Thu May 21, 2009 4:47 pm
by 13051191
for example change the colors and the icon? For example using a customized professionalcolortable or something like that?

Posted: Fri May 22, 2009 8:14 am
by 10050769
Hello dunion,
for example change the colors and the icon? For example using a customized professionalcolortable or something like that?

Only, is possible using source code of TeeChart .Net, thus could be do editors as you want.


Thanks,

Ok - so there's no way to maybe subclass this and modify?

Posted: Fri May 22, 2009 1:43 pm
by 13051191
Some of the other libraries I've worked with have some properties you can set, others you can sublcass the form as a class and override properties. The title on the dialog box (to better match my user application), the icon, color scheme, etc. would be helpful things to be allowed to be changed.

In the chart editor I know some options can be shown or not also - in this case I can live with all the options even if we don't need them, but the 'branding' and look would be nice to be able to modify. If we can't do this, can that be considered a 'request for future enhancement'?

I generally don't like the idea of mucking with the source code on third party libraries, then I have to keep them in sync all the time with upcoming releases.

The only other thing that might be a 'nice to have' is the ability to send in delegates to methods to handle specific file types and the ability to add custom file types.

I can always create such a control myself so it's not critical but it might be useful.

Posted: Mon May 25, 2009 10:28 am
by narcis
Hi dunion,

Actually a custom editor class can already be inherited from existing editors and some properties can be customized, for example:

Code: Select all

	public partial class Form1 : Form
	{
		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private void InitializeChart()
		{
			Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
			line1.FillSampleValues();
		}

		private void button1_Click(object sender, EventArgs e)
		{
			MyExportEditor editor = new MyExportEditor(tChart1.Chart, this);
			editor.Show();
		}	
	}

	public class MyExportEditor : Steema.TeeChart.Editors.Export.ExportEditor
	{
		public MyExportEditor(Steema.TeeChart.Chart c, Control parent)
		{
			Icon myIcon = new Icon(@"C:temp\teemaps.ico");
			this.Icon = myIcon;

			this.BackColor = Color.Blue;
		}
	}
However, in the example above only BackColor setting works, Icon doesn't. So I'll add your request to the wish-list to be considered for inclusion in future releases.

Almost:one error left - I need to set something else?

Posted: Tue May 26, 2009 4:25 pm
by 13051191
When I use the regular export
tchart.Export.ShowExportDialog(tchart.Export.Image.Bitmap);

all is well, I can go to the tab for Native and select file size and it's working. The show method for the inherited form

MyExportEditor editor = new MyExportEditor(tChart1.Chart, this);
editor.Show();

editor.Format won't let me assign the same format (read only), and when I try this (or many other operations) I get LoadErrorObject reference not set to an instance of an object.

What else do I need to set? If you have a link to the help for this and it's in there, that will be OK also.

Posted: Wed May 27, 2009 9:16 am
by narcis
Hi dunion,

Yes, sorry. The constructor declaration should change a little bit:

Code: Select all

		public MyExportEditor(Steema.TeeChart.Chart c, Control parent) : base(c, parent)
So you can do this:

Code: Select all

	public partial class Form1 : Form
	{
		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private void InitializeChart()
		{
			Steema.TeeChart.Styles.Points3D points3D1 = new Steema.TeeChart.Styles.Points3D(tChart1.Chart);
			points3D1.FillSampleValues();
		}

		private void button1_Click(object sender, EventArgs e)
		{
			MyExportEditor editor = new MyExportEditor(tChart1.Chart, null);
			editor.Show();
		}
	}

	public class MyExportEditor : Steema.TeeChart.Editors.Export.ExportEditor
	{
		public MyExportEditor(Steema.TeeChart.Chart c, Control parent) : base(c, parent)
		{
			Icon myIcon = new Icon(@"C:\temp\teemaps.ico");
			this.Icon = myIcon;

			this.BackColor = Color.Blue;
		}
	}
Note the little difference in the arguments values when creating a MyExportEditor instance.

That works, thanks

Posted: Wed May 27, 2009 3:01 pm
by 13051191
At one point something in this UI tries to write to the registry on one of the options - that's bad, it's not first checking the permissions - then it tosses and exception and dies (Vista x64, and this also happens in an admin account which the typcial users won't even have). This is every time 'Flex' is chosen.

That I'd call a bug :)

When I shut down and restarted VS I get designer support for the inherited form - This is helpful because I can use the names from the controls, find them in the controls list and then modify them at creation time. That lets me change the color of any of the controls I want to, and in theory I could mark them visible or not as a way of removing that option.

protected override void OnActivated(EventArgs e) {
RemoveFlex(this);
base.OnActivated(e);
}

public bool RemoveFlex(Control c) {
if (c.Name == "listBox1") {
if ((((ListBox)c).Items.Count > 0) &&
(((ListBox)c).Items[((ListBox)c).Items.Count - 1].ToString() == "as Flex (Flash)"))
((ListBox)c).Items.RemoveAt(((ListBox)c).Items.Count - 1);
return true;
} else {
foreach (Control ctl in c.Controls) {
if (RemoveFlex(ctl))
return true;
}
return false;
}
}

Posted: Thu May 28, 2009 9:07 am
by narcis
Hi dunion,

The editor reads the HKEY_LOCAL_MACHINE\SOFTWARE\Steema Software\TeeChart.NET\FlexCanvas_Temp key at the registry for checking where Flex temporary files should be stored. Other editor settings are stored too: language settings, position, gallery stile, etc.

Anyway, I'm not able to reproduce the issue you report here. Can you please let us know the exact TeeChart build you are using and the exact steps we should follow to reproduce it? Does this only happen in Vista 64-bit environments or can you reproduce it in 32-bit operating systems too?

Thanks in advance.

I tested on Vistax64 Only.

Posted: Thu May 28, 2009 1:36 pm
by 13051191
I didn't try on Vista x32, only Vista x64 (business), that's my development PC.

I was able to get it to break (running in debug mode) just by creating a chart, populating it, and using the default export editor with that chart and just clicking the save as flex;

The error happens with the base/intrinsic or the inherited class instance of this editor dialog.

This is not surprising to me. Although I'm logged in as an admin, I'm running in debug mode and I don't start VS with 'run as admin'. So I would actually expect to be denied registry access to the general area, you should only have access to the current users' area.

One needs to test with a non-admin account with full UAC stuff enabled with visual studio not running in admin mode. I would think in that case if you can access the registry there may be something wrong with the UAC settings?

The version is 3.5.3274.30664 in my references section for the library.

Note that on 32 bit systems for vista there is a 'hack' of sorts going on under the hood to try to make old applications appear to run correctly, it's called 'registry virtualization'. This shouldn't be counted on, my guess is it will be gone, except in virtual xp emulation mode, on Windows 7.

http://msdn.microsoft.com/en-us/library/aa965884.aspx

Re: I tested on Vistax64 Only.

Posted: Tue Jun 02, 2009 2:54 pm
by Chris
Hello!
To quote from that page:
Registry virtualization is enabled only for the following:

* 32-bit interactive processes
* Keys in HKEY_LOCAL_MACHINE\Software
* Keys that an administrator can write to.
So the most practical workaround, for the time being, is for you to run your instance of VS2008 with "run as admin". Sorry!
dunion wrote: So I would actually expect to be denied registry access to the general area, you should only have access to the current users' area.
Expected to be denied _write_ access, I agree. You should have read access though, no problem.
dunion wrote: This shouldn't be counted on, my guess is it will be gone, except in virtual xp emulation mode, on Windows 7.
I'm not so sure. According to this link: http://msdn.microsoft.com/en-us/library/aa965884.aspx
Windows 7 includes file and registry virtualization technology for applications that are not UAC compliant and that require an administrator's access token to run correctly. Virtualization ensures that even applications that are not UAC compliant are compatible withWindows 7.
Anyhow, this is an area that we will consider studying. The problem wouldn't exist if these registry entries were in HKEY_CURRENT_USER\Software, however, they are presently in HKEY_LOCAL_MACHINE\SOFTWARE for all present TeeChart for .NET clients. I have added the issue as an Enhancement in our tracking system with ticket number TF02014207.