Customizing TeeCommander button glyphs.

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
nile
Newbie
Newbie
Posts: 25
Joined: Tue Jan 20, 2009 12:00 am
Location: Auckland
Contact:

Customizing TeeCommander button glyphs.

Post by nile » Wed Jan 21, 2009 9:28 pm

I understand there is a tutorial or help pages on how to change the button images for TeeCommander. I've looked, and searched, but cannot find?

Thanks, Nile.
To be or not to be. This is not the question. Rather it is a choice.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Jan 22, 2009 9:01 am

Hi Nile,

Yes, tutorials, documentation, new features demo and examples can be found at TeeChart's program group created by the binary installers. By “TeeChart’s program group” I mean the Widnows’ TeeChart entry at Start Menu -> All Programs -> Steema TeeChart 8.04 for Delphi 2007. There you’ll find the “New Features Demo” shortcut. In the demo, going to "All Features\Welcome!\Toolbar\Custom buttons", you’ll find mentioned example.

Hope this helps!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

nile
Newbie
Newbie
Posts: 25
Joined: Tue Jan 20, 2009 12:00 am
Location: Auckland
Contact:

Post by nile » Fri Jan 23, 2009 2:18 am

Okay, found the help you mentioned, many thanks (although tabbing this help screen with c++ code would be a nice feature for those of us who get brain ache trying to read delphi!)

However, this only half answers my question. Take the following code:

TSpeedButton *tmpButton=TeeCommander1->CreateButton(100, &Button3Click, "Customize","",0);
tmpButton->Hint = "abc";
tmpButton->ShowHint = true;

First: Please allay my fears, and tell me that this button is created with the tCommander as parent, so i don't have to worry deleting the control?

Next, the hint doesn't work, and is I feel an important item on blind buttons. How to do?

Finally, while great for adding new buttons, this doesn't solve my immediate problem of changing the glyphs for the existing buttons, as we have a requirement that all interface buttons have the same look feel.

Options: Remove all buttons from Tcommander, and insert new. I have no problem with this as it's just code, but would ask help on:

1. How to delete all buttons from Tcommander.
2. A list of their onclick event contents so that i can use/manage in my replacement button events. e.g. ChartEditor->Execute() i know.

Cheers, nile.
To be or not to be. This is not the question. Rather it is a choice.

hansw
Newbie
Newbie
Posts: 3
Joined: Tue Jul 24, 2007 12:00 am

Post by hansw » Fri Jan 23, 2009 8:38 am

Hello,

you could set the Visible property of the TeeCommander to false and use your own buttons:

Activate normal mode:
TeeCommander1->ButtonNormal->Down = true

Activate Zoom:
TeeCommander1->ButtonZoom->Down = true

You can set Button->Down = true to emulate that only one function can be active.

HTH,

Regards

Hans

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Jan 23, 2009 9:28 am

Hi nile,
Okay, found the help you mentioned, many thanks (although tabbing this help screen with c++ code would be a nice feature for those of us who get brain ache trying to read delphi!)
There's also a C++ Builder version of the demo shipped with binary installers. You can find it, for example at C:\Program Files\Steema Software\TeeChart 8.04 for Delphi 2009\Examples\Features C++

Regarding what you are trying to do here, I think the best and easiest option is that you use existing TeeCommander and just replace glyphs in the sources at TeComma.pas. Buttons are created using the CreateButton method in TeeComma's CreateControls method.

Hope this helps!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

nile
Newbie
Newbie
Posts: 25
Joined: Tue Jan 20, 2009 12:00 am
Location: Auckland
Contact:

Post by nile » Fri Jan 23, 2009 11:33 pm

I think the easiest solution was to follow Hans suggestion. You need to be careful implementing the logic, such that all the right buttons turn on and off as they should, and also get ready to call the buttons underlying implementation where necessary.. eg, 3d, editor etc.

TeeCommander1->ButtonEdit->Click();

What i like about this approach is i get buttons with the glyphs i want, buttons with hints and using actions, a context menu for the tchart.

One remaining question on this though: Is there a single command to reset the entire chart back to default?

many thanks, nile
To be or not to be. This is not the question. Rather it is a choice.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Jan 26, 2009 9:05 am

Hi nile,
One remaining question on this though: Is there a single command to reset the entire chart back to default?
No, but you can implement ClearChart method as I posted here. ClearChart inclusion in TeeChart VCL sources is already on the wish-list to be considered for future releases.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

nile
Newbie
Newbie
Posts: 25
Joined: Tue Jan 20, 2009 12:00 am
Location: Auckland
Contact:

Post by nile » Mon Jan 26, 2009 10:07 pm

Hi Narcis,

Here's the c++ version for those that want it.

If i understand this correctly, you're using a new default chart to reset all of the old chart's parameters. Is there any need then to clear the chartsseries, as the old chart still remains?

I took out the snippet highlighted, and apart from having the wrong theme, the code worked nicely. I would however like confirmation for purposes of memory leaks etc, that this is a doable fix?


Finally, how do i obtain the current chart's theme, and assign this theme to the re-adjusted chart?

(i've looked at the code supplied, and it's unclear how this is done from an existing chart, without opening the theme editor, or accessing an existing theme from a list - as in the example code).


thanks nile.


void __fastcall TChartsNew::ClearAll(){
/*
TChartSeries* mychart;
for(int i=0; i< Chart->SeriesCount(); i++){
mychart = dynamic_cast<TChartSeries*>(Chart->Series);
if(mychart)
mychart->DataSource = NULL;
}
Chart->FreeAllSeries();
Chart->Tools->Clear();
*/

TDBChart* tmpChart = new TDBChart(this);
try{
tmpChart->Parent = Chart->Parent;

//Assign Chart's theme to tmpChart???

Chart->Assign(tmpChart);
}
__finally{
if(tmpChart){
delete tmpChart;
tmpChart = NULL;
}
}

}
To be or not to be. This is not the question. Rather it is a choice.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Feb 03, 2009 2:31 pm

Hi nile,
If i understand this correctly, you're using a new default chart to reset all of the old chart's parameters. Is there any need then to clear the chartsseries, as the old chart still remains?
If you are speaking about at what you asked before:
One remaining question on this though: Is there a single command to reset the entire chart back to default?
If you want to reset the chart so no series remain and default colors are still persist you should better call FreeAllSeries(nil) method. This will remove all series and will free associated memory. Then you can call TeeChart's default theme:

Code: Select all

  // Change Theme. The last parameter "-1" means to use the
  // default Theme color palette.
  ApplyChartTheme(tmp,Chart1,-1);
I took out the snippet highlighted, and apart from having the wrong theme, the code worked nicely. I would however like confirmation for purposes of memory leaks etc, that this is a doable fix?
Using suggestion above you should have any memory problem.
Finally, how do i obtain the current chart's theme, and assign this theme to the re-adjusted chart?
This is not implemented in v8 but it's on the wish-list to be included in future versions. The only option now is manually saving current theme and comparing it with your desired settings. You could do that also saving a *.tee file (TeeChart native template files) without data and loading it back. Or you can also use custom themes as explained here.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply