none
How to show the tooltip for touch screen?

    Question

  • I add the tooltips for some controls, when mouse hover these controls, the tooltips will show, but for the touch screen, the finger hold and press the controls, the tooltips will not show, how to show the tooltips when the finger hold and press the controls for touch screen? thank you.
    Sunday, August 31, 2014 11:26 PM

Answers

  • long press/hold in WinForms touch is akin to right clicking as far as windows is concerned. If I long hold on my surface pro on the desktop, I get the context menu as if I had right clicked. So this is more of a hacked up solution than something you can expect to work in every single scenario, but for WinForms you could add code to the MouseUp event of the controls you need to display tooltiptext for.

    Like this:

    Private Sub Button1_MouseUp(sender as object, e as MouseEventArgs) handles button1.MouseUP
        if e.button = windows.forms.mousebutton.right then
            tooltip1.show(tooltip1.gettooltip(button1),button1)
        end if
    end sub

    Then when the user does a long press on button1 and releases, the tooltip shows. Not 100% ideal for everything, but it could be the best you get with WinForms because there is no way for it to distinguish touch versus mouse.


    Matt Kleinwaks - MSMVP MSDN Forums Moderator - www.zerosandtheone.com

    • Marked as answer by gaxjyxq Thursday, September 04, 2014 2:36 AM
    Tuesday, September 02, 2014 8:48 PM
    Moderator

All replies

  • I add the tooltips for some controls, when mouse hover these controls, the tooltips will show, but for the touch screen, the finger hold and press the controls, the tooltips will not show, how to show the tooltips when the finger hold and press the controls for touch screen? thank you.

    Press and hold on that control which will display that tooltip just like mousehover that control.

    remember make the reply as answer and vote the reply as helpful if it helps.

    Monday, September 01, 2014 8:19 AM
  • No, when your finger press and hold on the control, the tooltip will not show.
    Monday, September 01, 2014 10:30 AM
  • Then I am afraid that may be impossible since the result shows that doesn't has the mousehover feature.

    remember make the reply as answer and vote the reply as helpful if it helps.

    Tuesday, September 02, 2014 7:19 AM
  • I add the tooltips for some controls, when mouse hover these controls, the tooltips will show, but for the touch screen, the finger hold and press the controls, the tooltips will not show, how to show the tooltips when the finger hold and press the controls for touch screen? thank you.

    If this is a Windows Forms rather than a WPF application then I don't believe touch is supported.

    WPF supports touch. So a WPF application can provide both touch and hover capability.

    Although the code in the below link, other than the xmal data, is in C# I believe it could be converted to VB.Net using Teleriks online C# to VB converter.

    tooltip/popup for text box to support touch screen without keyboard


    La vida loca

    Tuesday, September 02, 2014 5:26 PM
  • long press/hold in WinForms touch is akin to right clicking as far as windows is concerned. If I long hold on my surface pro on the desktop, I get the context menu as if I had right clicked. So this is more of a hacked up solution than something you can expect to work in every single scenario, but for WinForms you could add code to the MouseUp event of the controls you need to display tooltiptext for.

    Like this:

    Private Sub Button1_MouseUp(sender as object, e as MouseEventArgs) handles button1.MouseUP
        if e.button = windows.forms.mousebutton.right then
            tooltip1.show(tooltip1.gettooltip(button1),button1)
        end if
    end sub

    Then when the user does a long press on button1 and releases, the tooltip shows. Not 100% ideal for everything, but it could be the best you get with WinForms because there is no way for it to distinguish touch versus mouse.


    Matt Kleinwaks - MSMVP MSDN Forums Moderator - www.zerosandtheone.com

    • Marked as answer by gaxjyxq Thursday, September 04, 2014 2:36 AM
    Tuesday, September 02, 2014 8:48 PM
    Moderator
  • OK, thank you, i will try it.
    Tuesday, September 02, 2014 10:33 PM
  • Thank you, you are right.

    Another problem, i have added several tooltip controls in design time, want to enumerate all tooltip controls, but the way will not work.

     For Each EachC As Control In Me.Controls

             If typeof (EachC) is Tooltip Then

                  ......

             End If

     Next

    Thursday, September 04, 2014 2:41 AM
  • Typically you only need to add 1 tooltip to each form. ToolTips are extender controls which means when you add one of them to the form, any controls that can consume them automatically will show a tooltip text property at design time. ToolTips are form components, technically not controls, so they are not in the forms controls collection. I think you will find you only need 1 tooltip component on the form, you get the specific tooltip text of a given control by calling the GetToolTip method of the one tooltip component you added, passing in the control you want to get the tooltip for.

    Matt Kleinwaks - MSMVP MSDN Forums Moderator - www.zerosandtheone.com

    Thursday, September 04, 2014 2:28 PM
    Moderator