Re: Tooltip ans Sound - 2nd posting
- To: mathgroup at smc.vnet.net
- Subject: [mg93381] Re: Tooltip ans Sound - 2nd posting
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Wed, 5 Nov 2008 04:56:08 -0500 (EST)
- References: <gepb36$si1$1@smc.vnet.net>
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