MarksTip not being displayed

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Richard
Newbie
Newbie
Posts: 5
Joined: Thu Apr 30, 2009 12:00 am
Contact:

MarksTip not being displayed

Post by Richard » Tue Nov 24, 2009 1:12 pm

I have a Tchart contained in a pane of an Infragistics UltraDockManager (UDM) control (a bit like a splitter control with resizeable panes - but with a lot more built-in functionality). I add a MarksTip tool to the chart at run-time and everything works as expected except when I use the UDM's feature that lets you double-click a pane's header. This undocks the pane to show it in a resizeable window of its own. The MarksTip does not display while undocked from the main control, but starts working again when it is redocked. Could it be that the MarksTip is being displayed behind the undocked window - if so, is there any way to programmatically change the z layer of the MarksTip window?

I'm not sure if this is a Steema problem or an Infragistics one but...
Any ideas anyone?

Further to the above: I have now noticed that sometimes I see a very brief flash of the MarksTip as I move the mouse over the undocked chart - so it seems that the MarksTip is being displayed, but it is not in front of other windows.

P.S. The Tchart version I am using is 4.0.2009.21355. within VisualStudio 2008 (9.0.30729.1 SP) in a Windows Forms application.

Thanks,
Richard

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: MarksTip not being displayed

Post by Sandra » Fri Nov 27, 2009 11:55 am

Hello Richard,

I couldn't reproduce your problem using last version of TeeChart.Net and trial version of netadvantage here. Please, you could send us a simple project that we could reproduce here.


Thanks,
Best Regards,
Sandra Pazos / 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

Richard
Newbie
Newbie
Posts: 5
Joined: Thu Apr 30, 2009 12:00 am
Contact:

Re: MarksTip not being displayed

Post by Richard » Fri Nov 27, 2009 3:02 pm

Hello Sandra,

Thanks for your reply. My chart's context is too complex to provide a simple example, but I have observed something new:

If I undock the chart without ever having caused the MarksTip to be displayed, and then hover the mouse over a series, the MarksTip works fine. However, when I redock the chart, the MarksTip doesn't display - basically the opposite of the problem I described before. If I then undock it again, the MarksTip works.

This behaviour continues until I close then reopen the form containing the chart. So, depending on when the MarksTip is first displayed, it will only ever be displayed there in future.

I have attached a screenshot to help you understand the chart's environment.

Extracts from my code may also help to diagnose the problem...

The MarksTip is being declared as follows:
Private MarksTip1 As New Steema.TeeChart.Tools.MarksTip

The chart is initialised using:
Private Sub InitialiseChart()
TChart1.Chart.Tools.Add(MarksTip1)
MarksTip1.Style = Styles.MarksStyles.XY
MarksTip1.HideDelay = 5000
MarksTip1.MouseDelay = 100
AddHandler MarksTip1.GetText, AddressOf MarksTip1_GetText
Editor1.Chart = TChart1
ChartListBox1.Chart = TChart1
End Sub

The GetText event handler uses the series Tag contents to build its text:
Private Sub MarksTip1_GetText(ByVal sender As Steema.TeeChart.Tools.MarksTip, _
ByVal e As Steema.TeeChart.Tools.MarksTipGetTextEventArgs)
Dim strNew As String = ""
Dim strArray() As String
Try
'Tag comprises: ID_Stream & "," & strModule & "," & strStreamLabel & "," & strX & "," & strXunits _
' & "," & strY & "," & strYunits & "," & strXDoctored & "," & strYDoctored _
' & "," & idxX & "," & idxY
strArray = Split(SeriesUnderCursor.Tag.ToString, ",")
Dim tmp As Integer = e.Text.IndexOf(" ") 'x and y are separated by a space
'Assume X and Y are not both dates.
If UCase(strArray(4)) = "DATE" Then 'don't add units to string when X variable is a date
e.Text = SeriesUnderCursor.Title & Environment.NewLine & Environment.NewLine & _
strArray(7) & ": " & e.Text.Substring(0, tmp) & Environment.NewLine & _
strArray(8) & ": " & e.Text.Substring(tmp + 1) & " (" & strArray(6) & ")"
ElseIf UCase(strArray(6)) = "DATE" Then 'don't add units to string when Y variable is a date
e.Text = SeriesUnderCursor.Title & Environment.NewLine & Environment.NewLine & _
strArray(7) & ": " & e.Text.Substring(0, tmp) & " (" & strArray(4) & ")" & Environment.NewLine & _
strArray(8) & ": " & e.Text.Substring(tmp + 1)
Else
e.Text = SeriesUnderCursor.Title & Environment.NewLine & Environment.NewLine & _
strArray(7) & ": " & e.Text.Substring(0, tmp) & " (" & strArray(4) & ")" & Environment.NewLine & _
strArray(8) & ": " & e.Text.Substring(tmp + 1) & " (" & strArray(6) & ")"
End If
Catch ex As Exception

End Try
End Sub

I add a MouseEnter event handler for each series being added to the chart using:
AddHandler Line.MouseEnter, AddressOf line_MouseEnter

I then change the back/foreground colours during the MouseEnter event:
Private Sub line_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs)
'Set the series index for use in the markstip get text event (to add the series title to the tip)
SeriesUnderCursor = CType(sender, Steema.TeeChart.Styles.Line)
'If background colour is closer to white than black then use black foreground, else use white
MarksTip1.BackColor = SeriesUnderCursor.Color
If SeriesUnderCursor.Color.GetBrightness > 0.5 Then
MarksTip1.ForeColor = Color.Black
Else
MarksTip1.ForeColor = Color.White
End If
End Sub

Best regards,
Richard
Attachments
ReportScreen.jpg
Screenshot of entire report form
ReportScreen.jpg (457.84 KiB) Viewed 8139 times

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: MarksTip not being displayed

Post by Sandra » Mon Nov 30, 2009 10:28 am

Hello Richard,

Using last version 4 of TeeChart .Net and next code we couldn't reproduce the problem, there so as we have explained what happens to you. Please check next code works in last version 4 update, if the issue was solved. If it don't solve, please modifies code, because we can reproduce the issue here.

Code: Select all

Dim Markstips1 As Steema.TeeChart.Tools.MarksTip
Dim SeriesUnderCursor As Steema.TeeChart.Styles.Line
privateDim line2 As Steema.TeeChart.Styles.Line

    
    Private Sub InitializeChart()
        tChart1.Aspect.View3D = false
        Dim line As Steema.TeeChart.Styles.Line
        Markstips1 = New Steema.TeeChart.Tools.MarksTip(tChart1.Chart)
        line = New Steema.TeeChart.Styles.Line(tChart1.Chart)
        line2 = New Steema.TeeChart.Styles.Line(tChart1.Chart)
        line.FillSampleValues
        line2.FillSampleValues
        line.Pointer.Visible = true
        line2.Pointer.Visible = true
        Markstips1.Style = Steema.TeeChart.Styles.MarksStyles.XY
        Markstips1.HideDelay = 5000
        Markstips1.MouseDelay = 100
        AddHandler Markstips1.GetText, AddressOf Me.Markstips1_GetText
        AddHandler line.MouseEnter, AddressOf Me.line_MouseEnter
        AddHandler line2.MouseEnter, AddressOf Me.line_MouseEnter
        tChart1.Dock = DockStyle.Fill
    End Sub
    
    Private Sub Markstips1_GetText(ByVal sender As Steema.TeeChart.Tools.MarksTip, ByVal e As Steema.TeeChart.Tools.MarksTipGetTextEventArgs)
        ' string strNew = "";
        Dim strArray() As String
        Try 
            ' Tag comprises: ID_Stream & "," &strModule & "," & strStreamLabel & "," & strX & "," & strXunits _
            '  & "," & strY & "," & strYunits & "," & strXDoctored & "," & strYDoctored _
            '  & "," & idxX & "," & idxY
            strArray = SeriesUnderCursor.Tag.ToString.Split(Microsoft.VisualBasic.ChrW(44))
            Dim tmp As Integer = e.Text.IndexOf(" ")
            ' x and y are separated by a space
            ' Assume X and Y are not both dates.
            If (strArray(4).ToUpper = "DATE") Then
                ' don't add units to string when X variable is a date
                e.Text = (SeriesUnderCursor.Title  _
                            + (Environment.NewLine  _
                            + (Environment.NewLine  _
                            + (strArray(7) + (": "  _
                            + (e.Text.Substring(0, tmp)  _
                            + (Environment.NewLine  _
                            + (strArray(8) + (": "  _
                            + (e.Text.Substring((tmp + 1)) + (" ("  _
                            + (strArray(6) + ")"))))))))))))
            ElseIf (strArray(6).ToUpper = "DATE") Then
                ' don't add units to string when Y variable is a date
                e.Text = (SeriesUnderCursor.Title  _
                            + (Environment.NewLine  _
                            + (Environment.NewLine  _
                            + (strArray(7) + (": "  _
                            + (e.Text.Substring(0, tmp) + (" ("  _
                            + (strArray(4) + (")"  _
                            + (Environment.NewLine  _
                            + (strArray(8) + (": " + e.Text.Substring((tmp + 1))))))))))))))
            Else
                e.Text = (SeriesUnderCursor.Title  _
                            + (Environment.NewLine  _
                            + (Environment.NewLine  _
                            + (strArray(7) + (": "  _
                            + (e.Text.Substring(0, tmp) + (" ("  _
                            + (strArray(4) + (")"  _
                            + (Environment.NewLine  _
                            + (strArray(8) + (": "  _
                            + (e.Text.Substring((tmp + 1)) + (" ("  _
                            + (strArray(6) + ")")))))))))))))))
            End If
        Catch ex As Exception
            
        End Try
    End Sub
    
    Private Sub line_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs)
        ' Set the series index for use in the markstip get text event (to add the series title to the tip)
        Markstips1.BackColor = SeriesUnderCursor.Color
        If (SeriesUnderCursor.Color.GetBrightness > 0.5) Then
            Markstips1.ForeColor = Color.Black
        Else
            Markstips1.ForeColor = Color.White
        End If
    End Sub
    
    Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
        If (tChart1.Dock = DockStyle.Fill) Then
            tChart1.Dock = DockStyle.None
        Else
            tChart1.Dock = DockStyle.Fill
        End If
    End Sub
Thanks,
Best Regards,
Sandra Pazos / 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

Richard
Newbie
Newbie
Posts: 5
Joined: Thu Apr 30, 2009 12:00 am
Contact:

Re: MarksTip not being displayed

Post by Richard » Mon Nov 30, 2009 12:24 pm

Hello again Sandra,

I had to modify the code slightly to get it to work (see below). The MarksTip works OK when there is only a chart and a button on the form (before and after clicking the button).

I then added an Infragistics UltraDockManager (v 8.2.20082.2022), docked the button to the top pane and docked the chart to the bottom pane. The MarksTip only worked for either a docked chart OR an undocked chart - not both. (N.B. To toggle the docking status of the chart you just double-click the pane's header.)

As you would expect, when the controls are docked using the UltraDockManager, clicking the command button made no difference.

I think the TeeChart version I am using is the latest (4.02009.35592).

Public Class frmTestChart

Dim Markstips1 As Steema.TeeChart.Tools.MarksTip
Dim SeriesUnderCursor As New Steema.TeeChart.Styles.Line
Private line2 As Steema.TeeChart.Styles.Line


Private Sub InitializeChart()
tChart1.Aspect.View3D = False
Dim line As Steema.TeeChart.Styles.Line
Markstips1 = New Steema.TeeChart.Tools.MarksTip(tChart1.Chart)
line = New Steema.TeeChart.Styles.Line(tChart1.Chart)
line2 = New Steema.TeeChart.Styles.Line(tChart1.Chart)
line.FillSampleValues()
line2.FillSampleValues()
line.Pointer.Visible = True
line2.Pointer.Visible = True
Markstips1.Style = Steema.TeeChart.Styles.MarksStyles.XY
Markstips1.HideDelay = 5000
Markstips1.MouseDelay = 100
AddHandler Markstips1.GetText, AddressOf Me.Markstips1_GetText
AddHandler line.MouseEnter, AddressOf Me.line_MouseEnter
AddHandler line2.MouseEnter, AddressOf Me.line_MouseEnter
tChart1.Dock = DockStyle.Fill
End Sub

Private Sub Markstips1_GetText(ByVal sender As Steema.TeeChart.Tools.MarksTip, ByVal e As Steema.TeeChart.Tools.MarksTipGetTextEventArgs)
' string strNew = "";
Dim strArray() As String
Try
' Tag comprises: ID_Stream & "," &strModule & "," & strStreamLabel & "," & strX & "," & strXunits _
' & "," & strY & "," & strYunits & "," & strXDoctored & "," & strYDoctored _
' & "," & idxX & "," & idxY
strArray = SeriesUnderCursor.Tag.ToString.Split(Microsoft.VisualBasic.ChrW(44))
Dim tmp As Integer = e.Text.IndexOf(" ")
' x and y are separated by a space
' Assume X and Y are not both dates.
If (strArray(4).ToUpper = "DATE") Then
' don't add units to string when X variable is a date
e.Text = (SeriesUnderCursor.Title _
+ (Environment.NewLine _
+ (Environment.NewLine _
+ (strArray(7) + (": " _
+ (e.Text.Substring(0, tmp) _
+ (Environment.NewLine _
+ (strArray(8) + (": " _
+ (e.Text.Substring((tmp + 1)) + (" (" _
+ (strArray(6) + ")"))))))))))))
ElseIf (strArray(6).ToUpper = "DATE") Then
' don't add units to string when Y variable is a date
e.Text = (SeriesUnderCursor.Title _
+ (Environment.NewLine _
+ (Environment.NewLine _
+ (strArray(7) + (": " _
+ (e.Text.Substring(0, tmp) + (" (" _
+ (strArray(4) + (")" _
+ (Environment.NewLine _
+ (strArray(8) + (": " + e.Text.Substring((tmp + 1))))))))))))))
Else
e.Text = (SeriesUnderCursor.Title _
+ (Environment.NewLine _
+ (Environment.NewLine _
+ (strArray(7) + (": " _
+ (e.Text.Substring(0, tmp) + (" (" _
+ (strArray(4) + (")" _
+ (Environment.NewLine _
+ (strArray(8) + (": " _
+ (e.Text.Substring((tmp + 1)) + (" (" _
+ (strArray(6) + ")")))))))))))))))
End If
Catch ex As Exception

End Try
End Sub

Private Sub line_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs)
'*** CODE ADDED
SeriesUnderCursor = CType(sender, Steema.TeeChart.Styles.Line)

' Set the series index for use in the markstip get text event (to add the series title to the tip)
Markstips1.BackColor = SeriesUnderCursor.Color
If (SeriesUnderCursor.Color.GetBrightness > 0.5) Then
Markstips1.ForeColor = Color.Black
Else
Markstips1.ForeColor = Color.White
End If
End Sub

Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
If (tChart1.Dock = DockStyle.Fill) Then
tChart1.Dock = DockStyle.None
Else
tChart1.Dock = DockStyle.Fill
End If
End Sub

'*** CODE ADDED
Private Sub frmTestChart_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
InitializeChart()
End Sub
End Class

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: MarksTip not being displayed

Post by Sandra » Tue Dec 01, 2009 11:56 am

Hello Richard,

I could reproduce your problem and we have found that problem occurs because tool tips needs tChart1.parent for know to appears, and when you do undocked it tChart1.parent lost and tool tips doesn't know where to paint. I found a solution using AfterDockChange of ultraDockManager, Please see next code solve your problem.

AfterDockChange Event:

Code: Select all

        private void ultraDockManager1_AfterDockChange(object sender, Infragistics.Win.UltraWinDock.PaneEventArgs e)
        {
            
            if (tChart1.Parent == null)
            {
                tChart1.Parent = this;
            }
        }
I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / 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

Richard
Newbie
Newbie
Posts: 5
Joined: Thu Apr 30, 2009 12:00 am
Contact:

Re: MarksTip not being displayed

Post by Richard » Tue Dec 01, 2009 2:32 pm

Hi Sandra,

Thanks again for your reply. What I'm finding is that the "AfterDockChange" event does not fire when the pane's header is double-clicked - it only fires then the pane is dragged and dropped at another docking location (eg left, top, right, bottom). The "AfterToggleDockState" event does fire - however, when it does, I find that TChart1 never loses its parent. Also, forcing it to reset its parent within the event does not make a difference.

Regards,
Richard

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: MarksTip not being displayed

Post by Sandra » Wed Dec 02, 2009 12:57 pm

Hello Richard,

MarksTip tool uses System.Windows.Forms.TooTip (http://msdn.microsoft.com/en-us/library ... oltip.aspx). We found that they are painted under controls which are undocked from an UltraDockManager control. Setting those controls to transparent solves the problem.You may also know of some other way to deal with such issues with UltraDockManager or you may want to ask Infragistics if they are aware of similar issues.

On the other hand,I could reproduce same problem, using a simple panel of WinForms .Net. Please see next code that reproduce the issue:

Code: Select all

public Form1()
        {
            InitializeComponent();
            InitializePanel();

        }
        private void InitializePanel()
        {

            System.Windows.Forms.ToolTip tool1 = new ToolTip();
            panel1.BackColor = Color.Black;
            tool1.SetToolTip(this.panel1, "My panel1");

        }
If you could check, not only occurs when useTeeChart.Net, but also occurs in components of .Net. So I think it's a problem of infragistics components.

Thanks,
Best Regards,
Sandra Pazos / 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