Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. ToolTips

ToolTips

Scheduled Pinned Locked Moved C#
helpquestion
13 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V V 0

    Have you looked into the ToolTip class? MSDN No hurries, no worries.

    H Offline
    H Offline
    hpetriffer
    wrote on last edited by
    #3

    In this class I have not found any possibility to bind the shown text to a property of an object... Maybe there is a possibility but I don't find any... Regards Hansjörg

    V 1 Reply Last reply
    0
    • H hpetriffer

      In this class I have not found any possibility to bind the shown text to a property of an object... Maybe there is a possibility but I don't find any... Regards Hansjörg

      V Offline
      V Offline
      V 0
      wrote on last edited by
      #4

      hpetriffer wrote:

      bind the shown text to a property of an object

      Do you want to automatically update the text in both object property and tooltip? Write an event handler that updates them if the text changes? No hurries, no worries.

      H 1 Reply Last reply
      0
      • V V 0

        hpetriffer wrote:

        bind the shown text to a property of an object

        Do you want to automatically update the text in both object property and tooltip? Write an event handler that updates them if the text changes? No hurries, no worries.

        H Offline
        H Offline
        hpetriffer
        wrote on last edited by
        #5

        yes it seems that this is the only solution. But I have another problem with the tooltip. If I open a contextmenu of the object on which is displayed the standard tooltip (.net2.0). the tooltip is not displayed anymore. it is displayed only when I call SetToolTip another time... Regards Hansjörg

        V 1 Reply Last reply
        0
        • H hpetriffer

          yes it seems that this is the only solution. But I have another problem with the tooltip. If I open a contextmenu of the object on which is displayed the standard tooltip (.net2.0). the tooltip is not displayed anymore. it is displayed only when I call SetToolTip another time... Regards Hansjörg

          V Offline
          V Offline
          V 0
          wrote on last edited by
          #6

          keep the text in memory instead of relying on the tooltip... No hurries, no worries.

          H 1 Reply Last reply
          0
          • V V 0

            keep the text in memory instead of relying on the tooltip... No hurries, no worries.

            H Offline
            H Offline
            hpetriffer
            wrote on last edited by
            #7

            What do you mean with that exactly?

            V 1 Reply Last reply
            0
            • H hpetriffer

              Hello, maybe someone here can help me. I need something like a tooltip. In this tooltip should be displayed a string. Til now it is not complicated. But the problem is that the string should be bind to an object and so automatically updated. Is this possible? is there something available on the whole web? Regards Hansjörg

              C Offline
              C Offline
              cbhkenshin
              wrote on last edited by
              #8

              hi, you can change the tool tip text when ever needed. toolTip1.SetToolTip(this.button1, "My button1"); the follwing was from an external help: The following code example creates an instance of the ToolTip class and associates the instance with the Form that the instance is created within. The code then initializes the delay properties AutoPopDelay, InitialDelay, and ReshowDelay. In addition the instance of the ToolTip class sets the ShowAlways property to true to enable ToolTip text to always be display regardless of whether the form is active. Finally, the example associates ToolTip text with two controls on a form, a Button and a CheckBox. The code example requires that the method defined in the example is located within a Form that contains a Button control named button1 and a CheckBox control named checkBox1, and that the method is called from the constructor of the Form. Visual Basic ' This example assumes that the Form_Load event handling method ' is connected to the Load event of the form. Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles MyBase.Load ' Create the ToolTip and associate with the Form container. Dim toolTip1 As New ToolTip() ' Set up the delays for the ToolTip. toolTip1.AutoPopDelay = 5000 toolTip1.InitialDelay = 1000 toolTip1.ReshowDelay = 500 ' Force the ToolTip text to be displayed whether or not the form is active. toolTip1.ShowAlways = True ' Set up the ToolTip text for the Button and Checkbox. toolTip1.SetToolTip(Me.button1, "My button1") toolTip1.SetToolTip(Me.checkBox1, "My checkBox1") End Sub C# // This example assumes that the Form_Load event handling method // is connected to the Load event of the form. private void Form1_Load(object sender, System.EventArgs e) { // Create the ToolTip and associate with the Form container. ToolTip toolTip1 = new ToolTip(); // Set up the delays for the ToolTip. toolTip1.AutoPopDelay = 5000; toolTip1.InitialDelay = 1000; toolTip1.ReshowDelay = 500; // Force the ToolTip text to be displayed whether or not the form is active. toolTip1.ShowAlways = true; // Set up the ToolTip text for the Button and Checkbox. toolTip1.SetToolTip(this.button1, "My button1"); toolTip1.SetToolTip(this.checkBox1, "My checkBox1"); } C++ // This example assumes that the Form_Load event handling method // is connected to the Load event of the form. void Form1_Load( Object^ sender, System::EventArgs^ e ) {

              H 1 Reply Last reply
              0
              • H hpetriffer

                What do you mean with that exactly?

                V Offline
                V Offline
                V 0
                wrote on last edited by
                #9

                you have a string eg. "my dynamic text". If this text should change, you'ld like to change the property of your object and of your tooltip? Do something like: public void SetMyDynamicText(string input){ inmemorystring = input //UPDATE tooltip and property } something like that, it's getting difficult without really knowing what you'ld like to do... good luck. No hurries, no worries.

                H 1 Reply Last reply
                0
                • V V 0

                  you have a string eg. "my dynamic text". If this text should change, you'ld like to change the property of your object and of your tooltip? Do something like: public void SetMyDynamicText(string input){ inmemorystring = input //UPDATE tooltip and property } something like that, it's getting difficult without really knowing what you'ld like to do... good luck. No hurries, no worries.

                  H Offline
                  H Offline
                  hpetriffer
                  wrote on last edited by
                  #10

                  Okay this I understand, this I can solve when I make an event OnDataChanged or something else, where I can change the text of the tooltip... But I don't understand til now, why the tooltip doesn't show the text anymore when I open a contextmenu on the same object (I do nothing there!) Regards Hansjrög

                  V 1 Reply Last reply
                  0
                  • C cbhkenshin

                    hi, you can change the tool tip text when ever needed. toolTip1.SetToolTip(this.button1, "My button1"); the follwing was from an external help: The following code example creates an instance of the ToolTip class and associates the instance with the Form that the instance is created within. The code then initializes the delay properties AutoPopDelay, InitialDelay, and ReshowDelay. In addition the instance of the ToolTip class sets the ShowAlways property to true to enable ToolTip text to always be display regardless of whether the form is active. Finally, the example associates ToolTip text with two controls on a form, a Button and a CheckBox. The code example requires that the method defined in the example is located within a Form that contains a Button control named button1 and a CheckBox control named checkBox1, and that the method is called from the constructor of the Form. Visual Basic ' This example assumes that the Form_Load event handling method ' is connected to the Load event of the form. Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles MyBase.Load ' Create the ToolTip and associate with the Form container. Dim toolTip1 As New ToolTip() ' Set up the delays for the ToolTip. toolTip1.AutoPopDelay = 5000 toolTip1.InitialDelay = 1000 toolTip1.ReshowDelay = 500 ' Force the ToolTip text to be displayed whether or not the form is active. toolTip1.ShowAlways = True ' Set up the ToolTip text for the Button and Checkbox. toolTip1.SetToolTip(Me.button1, "My button1") toolTip1.SetToolTip(Me.checkBox1, "My checkBox1") End Sub C# // This example assumes that the Form_Load event handling method // is connected to the Load event of the form. private void Form1_Load(object sender, System.EventArgs e) { // Create the ToolTip and associate with the Form container. ToolTip toolTip1 = new ToolTip(); // Set up the delays for the ToolTip. toolTip1.AutoPopDelay = 5000; toolTip1.InitialDelay = 1000; toolTip1.ReshowDelay = 500; // Force the ToolTip text to be displayed whether or not the form is active. toolTip1.ShowAlways = true; // Set up the ToolTip text for the Button and Checkbox. toolTip1.SetToolTip(this.button1, "My button1"); toolTip1.SetToolTip(this.checkBox1, "My checkBox1"); } C++ // This example assumes that the Form_Load event handling method // is connected to the Load event of the form. void Form1_Load( Object^ sender, System::EventArgs^ e ) {

                    H Offline
                    H Offline
                    hpetriffer
                    wrote on last edited by
                    #11

                    I know that solution, but here it is not possible to update the text of the tooltip automatically. The only solution to solve this is to generate an event OnDataChanged and then to update the ToolTip text...

                    1 Reply Last reply
                    0
                    • H hpetriffer

                      Okay this I understand, this I can solve when I make an event OnDataChanged or something else, where I can change the text of the tooltip... But I don't understand til now, why the tooltip doesn't show the text anymore when I open a contextmenu on the same object (I do nothing there!) Regards Hansjrög

                      V Offline
                      V Offline
                      V 0
                      wrote on last edited by
                      #12

                      check if the active property is still true after the context menu, if it is I wouldn't know either :-( No hurries, no worries.

                      H 1 Reply Last reply
                      0
                      • V V 0

                        check if the active property is still true after the context menu, if it is I wouldn't know either :-( No hurries, no worries.

                        H Offline
                        H Offline
                        hpetriffer
                        wrote on last edited by
                        #13

                        I have set the property also to true in the contextmenu. But I saw alos that if I press ESC in the contextmenu the tooltip is not shown anymore :-((( Thanks for your help!!!

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups