ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  ChartViewer uses up GDI objects.
Posted by David Wilson on Oct-25-2019 23:49
Many thanks for your past help.


I have a suggestion.

The CChartViewer constructor calls

    m_ToolTip.Create(this).

This call uses up two GDI objects.

Our application creates many (many many) charts in memory, not intended for screen display. These charts create CChartViewers for purposes unrelated to screen display. Creating many CChartViewers calls m_ToolTip.Create() on many CToolTipCtrl objects, which uses up many GDI objects. GDI objects are a finite resource, and creating too many of them can cause the application or Windows itself to have display bugs or crash.

I suggest  that in the your Windows sources for CChartViewer, you delay calling m_ToolTip.Create() until you know that CChartViewer is actually being displayed on the screen.


- David Wilson

  Re: ChartViewer uses up GDI objects.
Posted by Peter Kwan on Oct-28-2019 20:34
Hi David,

If you are not using the GUI features of CChartViewer (eg. mouse event handling), note that many of the CChartViewer features are available in ViewPortManager and ImageMapHandler as well.

The ViewPortManager and ImageMapHandler are the non-GUI specific part of the chart viewer. The MFC CChartViewer and Qt QChartViewer implement the GUI specific part of the chart viewer and use ViewPortManager and ImageMapHandler to keep track of the viewport and hotspots. One of our customers even ported the chart viewer to another GUI framework wxWidgets.

the CToolTipCtrl works by listening to mouse events. It pops up a tooltip box if the mouse moves then stops for a while. It will hide the tooltip box if the mouse stops for too long. This means the CToolTipCtrl needs to exist so it can listen to the mouse events while the mouse is still moving, before it knows if it needs to display any tooltip.

If we modify the code so that the CToolTipCtrl is created when the CChartViewer first receives a mouse move message, would it work for your case? (Would your CChartViewer receives mouse message?)

Regards
Peter Kwan

  Re: ChartViewer uses up GDI objects.
Posted by David Wilson on Oct-28-2019 21:37
We have addressed the issue in our application.

I was simply informing you of the issue in case you wanted to address it in your distributed sources.

- Dave Wilson