|
Unicode Tooltips |
Posted by Zev Toledano on Apr-08-2016 02:50 |
|
Hello,
I just noticed that when using the ChartViewer.ocx in a VB6 desktop app, the tooltips don't seem to support Unicode. Is there any way to display Unicode tooltips?
(Chartviewer version is 5.0.0. ChartDir.dll is 5.0.3.1. I know this is old but would a new version help?)
Thank you |
Re: Unicode Tooltips |
Posted by Peter Kwan on Apr-08-2016 22:45 |
|
Hi Zev Toledano,
Actually, ChartDirector does support Unicode in the image maps, but VB6 itself does not support Unicode tooltips. For testing, you can try to put some international characters in the tooltip of a standard VB6 control (such as a push button). If those characters can be displayed in the tooltip, the same characters should work in ChartDirector as well.
To work around the VB6 tooltip limitation, one method is not to use the tooltip feature in VB6, but to create your own pop-up box. You may use a VB6 control that can display Unicode characters, then in the MouseMoveHotSpot event handler, you can use that control to display the tooltip (the "title" attribute) and move that control so that it follows the mouse.
You may Google "VB6 tooltip unicode characters" to find some examples in working around the VB6 tooltip limitation.
Regards
Peter Kwan |
Re: Unicode Tooltips |
Posted by Zev Toledano on Apr-10-2016 01:31 |
|
Thanks, but I thought the ChartViewer was creating the tooltips? To be precise, VB6 does support Unicode, it's only the built-in VB6 components that don't. We made our app 100% Unicode by buying only Unicode components or writing our own. All of the components we use display Unicode tooltips. It's only now we found out that the graph tooltips are the only things that are not Unicode (we picked ChartDir at the time because it does support Unicode).
I will try to use the method you recommended to write my own tooltip for the graph in a few days, but doesn't it make more sense to make ChartDir 100% Unicode instead of just 99%?
Thank you. |
Re: Unicode Tooltips |
Posted by Zev Toledano on Apr-11-2016 01:08 |
|
I'm trying to implement my own tooltip so far with no success.
I got the tooltip value out of the hotspot and ChartViewer event, and I have a Unicode tooltip component that uses Win API, but I cannot make it show a tooltip over the ChartViewer. It seems it can only work with a hwnd handle (and ChartViewer does not provide one), OR with the parent container of the ChartViewer, except that the ChartViewer isn't windowless so the tooltip component does not get the mousemove events it needs to show the tooltip (I'm guessing this is why it doesn't work).
To program a floating form that moves around does not seem practical, as it can grab focus and cause other problems when the user moves over it or clicks on it. I need a floating tooltip. Is there any sample code that you have seen that works? |
Re: Unicode Tooltips |
Posted by Zev Toledano on Apr-11-2016 03:45 |
|
Update:
I succeeded by searching for the hwnd of the ChartViewer using the EnumChildWindows Windows API. I used the coords to position the tooltip. So far so good.
Ironically, the only thing standing in my way now is that I can't find a way to turn off the built-in ChartViewer tooltips! How do I enable all the hotspots and make the 'MouseMoveHotSpot' event give me the tooltip value, but at the same time turn off display of the tooltip? |
Re: Unicode Tooltips |
Posted by Peter Kwan on Apr-11-2016 17:15 |
|
Hi Zev,
In ChartDirector, the ChartViewer control is a subclass of the VB6 UserControl, and it is using the VB6 tooltip facility, so the tooltip behaves in the same way as other standard VB6 control.
Before I see you message, I have tried myself and created the attached example. I realize all standard VB controls can only display characters in the locale of the application and not arbitrary unicode characters. So I just use a separate small chart object with just a text box as the tootip, and use the "MouseMoveHotSpot" method to put the tooltip on the chart. One feature of this method is that you add other custom things in the tooltip, including showing another chart in the tooltip.
In VB6, there is no "Mouse Out" or "Mouse Leave" event. To turn off the tooltip when the mouse is not on the tooltip, the method I use is to handle the MouseMove event of the chart object. If the mouse is moving on the chart but not on the hot spot, we can hide the tooltip object.
To turn off the built-in ChartDirector tooltips, just do not use the "title='xxx'" attribute. In my code, I use:
ChartViewer1.ImageMap = c.getHTMLImageMap("clickable", "tooltip={xLabel}: US${value}K")
then in the MouseMoveHotSpot event, I use the following code to read the tooltip on the hot spot:
Dim toolTip As String
On Error Resume Next
toolTip = hotSpot("tooltip")
On Error GoTo 0
(The On Error above is to avoid the code from breaking if the image map happens not to contain the tooltip attribute.)
Regards
Peter Kwan
|
Re: Unicode Tooltips |
Posted by Zev Toledano on Apr-11-2016 19:49 |
|
Thank you!
My difficulty was that I had multiple charts (MultiChart) and wasn't setting the ImageMap properly everywhere and didn't remove the "title=" values.
In any case it also works now with the Win API tooltip and ChartViewer hwnd. Thanks. |
|