EOutofResource when zooming tchart
EOutofResource when zooming tchart
I place about 20 to 30 TChart object. And then i call scaleby to zoom each tchart object to 400%. Then i get EOutofResource error when i scrolling up or scrolling down. How to solve it?
my test code is like this:
//test.h
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TButton *Button1;
TButton *Button2;
void __fastcall Button1Click(TObject *Sender);
void __fastcall FormCreate(TObject *Sender);
void __fastcall FormDestroy(TObject *Sender);
void __fastcall Button2Click(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
//test.cpp
TForm1 *Form1;
TList *pLst;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
VertScrollBar->Range = 1123;
HorzScrollBar->Range = 794;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
int i; TChart *pObj;
for(i = 0; i < 10; i++)
{
pLst->Add(new TChart(this));
pObj = (TChart*) pLst->Items[pLst->Count-1];
pObj->Parent = this;
pObj->Left = 50 + ((i) * 20);
pObj->Top = 50 + ((i) * 20);
}
pObj = NULL;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
pLst = new TList();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormDestroy(TObject *Sender)
{
int i;
while(pLst->Count > 0)
{
pLst->Delete(pLst->Count - 1);
}
delete pLst;
pLst = NULL;
}
//---------------------------------------------------------------------------
//Zoom to 400%
void __fastcall TForm1::Button2Click(TObject *Sender)
{
int i; TChart *pObj;
VertScrollBar->Range *= 4;
HorzScrollBar->Range *= 4;
for(i = 0; i < pLst->Count; i++)
{
pObj = (TChart*) pLst->Items;
pObj->ScaleBy(400,100);
pObj->Top *= 4;
pObj->Left *= 4;
}
pObj = NULL;
}
//---------------------------------------------------------------------------
Thank you
my test code is like this:
//test.h
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TButton *Button1;
TButton *Button2;
void __fastcall Button1Click(TObject *Sender);
void __fastcall FormCreate(TObject *Sender);
void __fastcall FormDestroy(TObject *Sender);
void __fastcall Button2Click(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
//test.cpp
TForm1 *Form1;
TList *pLst;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
VertScrollBar->Range = 1123;
HorzScrollBar->Range = 794;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
int i; TChart *pObj;
for(i = 0; i < 10; i++)
{
pLst->Add(new TChart(this));
pObj = (TChart*) pLst->Items[pLst->Count-1];
pObj->Parent = this;
pObj->Left = 50 + ((i) * 20);
pObj->Top = 50 + ((i) * 20);
}
pObj = NULL;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
pLst = new TList();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormDestroy(TObject *Sender)
{
int i;
while(pLst->Count > 0)
{
pLst->Delete(pLst->Count - 1);
}
delete pLst;
pLst = NULL;
}
//---------------------------------------------------------------------------
//Zoom to 400%
void __fastcall TForm1::Button2Click(TObject *Sender)
{
int i; TChart *pObj;
VertScrollBar->Range *= 4;
HorzScrollBar->Range *= 4;
for(i = 0; i < pLst->Count; i++)
{
pObj = (TChart*) pLst->Items;
pObj->ScaleBy(400,100);
pObj->Top *= 4;
pObj->Left *= 4;
}
pObj = NULL;
}
//---------------------------------------------------------------------------
Thank you
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Herman,
Which TeeChart version are you using? I tested your code using latest v7.04 version and creating up to 40 TChart objects without getting the error you report.
Which TeeChart version are you using? I tested your code using latest v7.04 version and creating up to 40 TChart objects without getting the error you report.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Herman,
This is also the version I used. Could you please send us a test project we can run "as-is" to reproduce the problem here? You can post it at [url]news://www.steema.net/steema.public.attachments[/url] newsgroup.
Thanks in advance.
This is also the version I used. Could you please send us a test project we can run "as-is" to reproduce the problem here? You can post it at [url]news://www.steema.net/steema.public.attachments[/url] newsgroup.
Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Herman,
It's really strange, I've already sent the .exe you request could you please run it and let me know how it went? I'm running in the following specs:
Win 2003 Server Ent + SP1.
Pentium 4 3.2Ghz.
1 GB RAM
Also which BCB6 version are you using? I use BCB6 Enterprise with update 4 installed (latest available).
It's really strange, I've already sent the .exe you request could you please run it and let me know how it went? I'm running in the following specs:
Win 2003 Server Ent + SP1.
Pentium 4 3.2Ghz.
1 GB RAM
Also which BCB6 version are you using? I use BCB6 Enterprise with update 4 installed (latest available).
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Herman,
As I suggested on my previous post please install ALL BCB6 official updates as it's mandatory for TeeChart.
As I suggested on my previous post please install ALL BCB6 official updates as it's mandatory for TeeChart.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Herman,
Have you tried the second .exe file I sent you? The 2nd one is compiled without run-time packages and shouldn't depend on your BCB6 installation files.
Have you tried the second .exe file I sent you? The 2nd one is compiled without run-time packages and shouldn't depend on your BCB6 installation files.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
When i debugging it, it stops in
File : Graphics.pas
procedure GDIError;
var
ErrorCode: Integer;
Buf: array [Byte] of Char;
begin
ErrorCode := GetLastError;
if (ErrorCode <> 0) and (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, nil,
ErrorCode, LOCALE_USER_DEFAULT, Buf, sizeof(Buf), nil) <> 0) then
raise EOutOfResources.Create(Buf)
else
OutOfResources;
end;
Thank you
File : Graphics.pas
procedure GDIError;
var
ErrorCode: Integer;
Buf: array [Byte] of Char;
begin
ErrorCode := GetLastError;
if (ErrorCode <> 0) and (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, nil,
ErrorCode, LOCALE_USER_DEFAULT, Buf, sizeof(Buf), nil) <> 0) then
raise EOutOfResources.Create(Buf)
else
OutOfResources;
end;
Thank you
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Herman,
After testing the application on several machines I was able to reproduce the problem in one of them which is very similar to mine. We concluded it would be related to internal bitmap.
So, is it absolutely necessary to zoom/update 30 charts? I mean, perhaps the solution would be to set each chart autorepaint to false, do the zoom (for all charts) and then refresh charts. This worked on the "problematic" machine.
I've already sent you the test application I created with those changes applied, could you please check if this works for you?
Another thing which wouldn't hurt would be upgrading your graphical card drivers which can be the cause of this problem.
After testing the application on several machines I was able to reproduce the problem in one of them which is very similar to mine. We concluded it would be related to internal bitmap.
So, is it absolutely necessary to zoom/update 30 charts? I mean, perhaps the solution would be to set each chart autorepaint to false, do the zoom (for all charts) and then refresh charts. This worked on the "problematic" machine.
I've already sent you the test application I created with those changes applied, could you please check if this works for you?
Another thing which wouldn't hurt would be upgrading your graphical card drivers which can be the cause of this problem.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |