Sign in to follow this  
Followers 0
pekster

Update Gui Tooltip

6 posts in this topic

I wish to change the tooltip data depending on what the user does. I have created a simple example to this effect below. Currently I am running this script under windows ME, and instead of updating the tooltip, it creates another tooltip. Then, when I mouse over the button, it shows me the first tooltip I created, pauses for about half a second, and then the next tooltip comes sliding down to cover up the first. This process goes on for however many GuiSetControlEx() commands I have used that have changed the tooltip. The process occurs every time I mouse onto the button. I am not sure if XP will react the same way, and I will test it when I get home to my XP box.

Opt("GuiCoordMode", 2)
$clicked = 0

GuiCreate("Title", 100, 50)

GuiSetCoord(0, 0, 100, 20)
$button = GuiSetControl("button", "Presser", -1, -1)
  $button_N = GuiSetControlNotify()
GuiSetControlEx(-1, -1, -1, "Button pressed 0 times")

GuiShow()

While 1
  $n = GuiMsg(0)
  Sleep(200)
  If $n = -3 Then Exit
  If $n = $button_N Then
    $clicked = $clicked + 1
    GuiSetControlEx($button, -1, -1, "Button pressed " & $clicked & " times")
  EndIf
WEnd

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites



I have discovered a workaround for this problem. It's not really a solution since it hides the existing button, creates a new one with the same name, and adds a tooltip to the new one. Perhaps it will help lead to a better solution.

$clicked = 0

GuiCreate("Title", 100, 50)

$button = GuiSetControl("button", "Presser", 0, 0, 100, 20)
  $button_N = GuiSetControlNotify()
  GuiSetControlEx(-1, -1, -1, "Button pressed 0 times")

GuiShow()

While 1
  $n = GuiMsg(0)
  Sleep(200)
  If $n = -3 Then Exit
  If $n = $button_N Then
    $clicked = $clicked + 1
   ;hide the old button:
    GuiSetControlEx($button, 32)
   ;new button with same name in same position:
    $button = GuiSetControl("button", "Presser", 0, 0, 100, 20)
     ;same nofity name:
      $button_N = GuiSetControlNotify()
     ;new tooltip:
      GuiSetControlEx($button, -1, -1, "Button pressed " & $clicked & " times")
  EndIf
WEnd

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

Technical talk:

JP, you are probably sending the add tooltip message every time, correct? You can modify a currently existing tooltip, so you might need to check to make sure the control doesn't have a tooltip before adding one.

pekster:

It's likely a bug which can be fixed but until then you will need to use a workaround.

Share this post


Link to post
Share on other sites

Technical talk:

JP, you are probably sending the add tooltip message every time, correct?  You can modify a currently existing tooltip, so you might need to check to make sure the control doesn't have a tooltip before adding one.

pekster: 

It's likely a bug which can be fixed but until then you will need to use a workaround.

Thanks,

I am back I will work on it to night :D

Share this post


Link to post
Share on other sites

Technical talk:

JP, you are probably sending the add tooltip message every time, correct?  You can modify a currently existing tooltip, so you might need to check to make sure the control doesn't have a tooltip before adding one.

pekster: 

It's likely a bug which can be fixed but until then you will need to use a workaround.

@valik

I try some code to fix it but it does not work.

it there a way to get without having memorize the handle needed to update an existing tip on a control. I try TTM_GETCURRENTTOOL with the handle control no success

Thanks for the help :D

Share this post


Link to post
Share on other sites

I found a fix will be available in Gui 102.23

Thanks for your help :D

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0