MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Tooltip ans Sound - 2nd posting

  • To: mathgroup at smc.vnet.net
  • Subject: [mg93430] Re: [mg93400] Re: Tooltip ans Sound - 2nd posting
  • From: John Fultz <jfultz at wolfram.com>
  • Date: Fri, 7 Nov 2008 06:02:26 -0500 (EST)
  • Reply-to: jfultz at wolfram.com

Tooltip recreates the tooltip window from scratch every time the window pops up 
for some reason.  It's analagous to having a Dynamic that's in a saved file, but 
you keep closing and re-opening the file.  Every time the window is created
freshly, the Dynamic is re-evaluated yet again.  This is something of an 
implementational detail for Tooltip...we didn't have to implement Tooltip this 
way (given the documentation), but that's how it's done right now.

If I were to create a solution to the original problem, I'd probably use Dynamic 
in Mouseover...something like this...

Mouseover[Dynamic[strobe = True; strobe; abcd], 
 Dynamic[strobe = False; strobe; EmitSound[snd]; abcd]]

Sincerely,
 
John Fultz
jfultz at wolfram.com
User Interface Group
Wolfram Research, Inc.


On Thu, 6 Nov 2008 04:05:57 -0500 (EST), dh wrote:
>
>
> Hallo David,
>
> I would like to understand your solution. Why is EmitSound evaluated? I
>
> (probably wrongly) thought that Dynamic[..] is reevaluated only if the
>
> argument changes, not on every display.
>
> Daniel
>
>
> David Bailey wrote:
>
>> axel wrote:
>>
>>> Hello,
>>>
>>>
>>> I have found that Tooltip[obj1, obj2] evaluates obj2 upon a mouseover
>>>
>>> event on obj1. The objects can either be Text or Graphics, all
>>>
>>> combinations work. Here is my question: can I use a Sound as obj2? I
>>>
>>> want to hear a specific sound when my mouse enters the notebook area
>>>
>>> occupied by obj1.
>>>
>>>
>>> Thank you
>>>
>>>
>>> Axel
>>>
>>>
>>> PS: using Tooltip[obj1, Play[...]] works but is not useful because one
>>>
>>> cannot reach the play-button. Also, I want to hear the sound upon the
>>>
>>> mouseover event, without the need of further action.
>>
>>
>> I don't think obj2 is evaluated at the point of mouseover, but that
>>
>> would not stop obj2 being a graphics object. To get an immediate sound
>>
>> (as opposed to a widget that can play a sound) you need EmitSound, which
>>
>> needs to execute when it is displayed, which you can get using Dynamic:
>>
>>
>> Tooltip[fred,
>>
>> Dynamic[EmitSound[
>>
>> Sound[{SoundNote["c5", 0.3], SoundNote["g4", 0.3]}]]; ""]]
>>
>>
>> David Bailey
>>
>> http://www.dbaileyconsultancy.co.uk




  • Prev by Date: Re: Creating animated 3d graphic in Mathematica for export
  • Next by Date: RE: Re: Constructing a Label
  • Previous by thread: Re: Tooltip ans Sound - 2nd posting
  • Next by thread: Constructing a Label