|
group/merge |
Posted by Pandey on Aug-01-2013 20:28 |
|
Greetings!!Peter
I have a winchart displayed on my managed c++ form. I have created an editable windows text box over it, now I want to export the image(winchart+textbox) as a whole when I do this:
c->makeChart("cMove.jpeg");
Is it possible? In the current scenario it dumps me only the winchart image
Thanks,
Pandey |
Re: group/merge |
Posted by Peter Kwan on Aug-02-2013 04:42 |
|
Hi Pandey,
For BaseChart.makeChart applies only to the chart object, not to other objects which are not part of the chart, even if they are put on top of the chart. It is the same reason why the chart image does not include the mouse cursor (even if you put the mouse cursor on top of the chart), or does not include other Windows in your screen (even if the Window happens to partially or fully overlap with the chart).
To include things as visible on the screen, you would need to take a screen shot instead. (I think this can be done programmatically, but then it may also include other Windows happened to overlap with the chart.)
For your case, when the editing is finished, you may consider to use BaseChart.addText to add the text to the chart, and then hide the text box. Even Microsoft's GUI is using similar methods. For example, if you try to change the label of an icon on your Desktop, Windows will put a textbox over the original icon label for editing (you can easily see that because the alignment of the textbox with the original label is not perfect). After editing, the textbox is hidden and the label of the icon is updated.
Hope this can help.
Regards
Peter Kwan |
Re: group/merge |
Posted by Pandey on Aug-02-2013 11:26 |
|
Peter, my requirement is, user edits the text box and places it on the chart at a place where there is sufficient space and is readable. My text box is floating and is placed on the chart using mouse events.
Is there such a possibility in the chart director itself to have a floating text box or label over the chart that after editing can be saved together with the winchart?
Thanks,
Pandey |
Re: group/merge |
Posted by Peter Kwan on Aug-03-2013 01:04 |
|
Hi Pandey,
After the text box is placed on the chart, you may use BaseChart.addText to add the text to the chart, and hide the text box. In this way, the text will become part of the chart.
When the user clicks on the text again, you may show the text box again, so the user can drag on it and move it and edit it. (Even the text box is hidden, you can still obtain its coordinates, so your code may detect if the user is clicking on the text box by compating the mouse coordiantes with the coordinates of the text box.)
ChartDirector currently does not have an user editable floating text box (which is essentially just a standard TextBox). As you have already written your system using a standard TextBox, all you need to do is to apply the text to the chart.
Hope this can help.
Regards
Peter Kwan |
Re: group/merge |
Posted by Pandey on Aug-06-2013 20:11 |
|
Thanks! Works well
Only issue is how to remove the previous addText.
When I reposition my text box to new location and do addText, there is still previous one on the chart.
c->addText(TrendX, TrendY, sCoefficientText, "Tahoma", 9);
Thanks
Pandey |
Re: group/merge |
Posted by Peter Kwan on Aug-07-2013 01:11 |
|
Hi Pandey,
There are two methods:
(a) Use the "dynamic layer" (BaseChart.initDynamicLayer). You may refer to the "Programmable Track Cursor" sample code as reference. For example, in the "Track Line with Data Labels" sample code, as the mouse moves, the floating text are added using BaseChart.addText on the dymamic layer.
(b) Everytime you would like to add or change the text, you may redraw the chart, and add the text. It is like:
drawChart();
... add the text using addText ...
So everytime your code starts with a freshly drawn chart that has no text on it, and add the updated text box to it.
Hope this can help.
Regards
Peter Kwan |
|