Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: Tooltip ans Sound - 2nd posting

  • To: mathgroup at smc.vnet.net
  • Subject: [mg93422] Re: Tooltip ans Sound - 2nd posting
  • From: David Bailey <dave at removedbailey.co.uk>
  • Date: Fri, 7 Nov 2008 06:00:58 -0500 (EST)
  • References: <gepb36$si1$1@smc.vnet.net> <gerqjb$res$1@smc.vnet.net> <geuc1g$fev$1@smc.vnet.net>

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
> 
> 
> 
> 
> 
> 
Of course, I tested that this works! It was something of a hunch - I 
guessed that the dynamic mechanism does not track every tooltip that is 
not active - there could be a lot in certain applications - and 
therefore that it would probably need to re-evaluate when the tooltip 
got displayed.

David Bailey
http://www.dbaileyconsultancy.co.uk


  • Prev by Date: Re: NIntegrate[UnitStep[...]PDF[...],{x,...}] hard to integrate
  • Next by Date: Re: NIntegrate[UnitStep[...]PDF[...],{x,...}] hard to integrate
  • Previous by thread: Re: Tooltip ans Sound - 2nd posting
  • Next by thread: Re: Re: Tooltip ans Sound - 2nd posting