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

MathGroup Archive 2010

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

Search the Archive

Re: use of a button

  • To: mathgroup at smc.vnet.net
  • Subject: [mg106927] Re: [mg106909] use of a button
  • From: "David Park" <djmpark at comcast.net>
  • Date: Thu, 28 Jan 2010 02:45:55 -0500 (EST)
  • References: <5974217.1264591814629.JavaMail.root@n11>

Alexei,

Because it has to carry out some action. So what you need here is:

rose = Import["ExampleData/rose.gif"]

Button["Show rose", Print@rose] 

You could also place the button as an Inline Cell in a Text cell. But notice
that each time you click the button you get an additional copy of the image.
And when it is in a Text cell the Delete Output menu item won't work on it.

With Presentation you can do a little better using the presentationButton.
That was designed to generate 'page' displays for examples or derivations.
The displays might be defined elsewhere and be quite extensive. But it also
works in this simpler case.

Needs["Presentations`Master`"] 

presentationButton["Show rose", rose]

That gives you a button that better merges into a line of text, generates
only a single copy of the image in the cell below the text no matter how
many times it is pressed, and also allows you to launch the image in a
separate window. Furthermore, if you use the Presentations style
"EvaluableText" for the text cell, the Delete Output command will work.


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  



From: Alexei Boulbitch [mailto:Alexei.Boulbitch at iee.lu] 


Dear Community,

I have a lack of understanding.  (OK, I have many, but today it is about 
only one of them).  I want to make a button to show in my presentation 
an image upon pressing. However, the operation like

Button["Image name", image_identifier] does not work. To be concrete, this:

rose = Import["ExampleData/rose.gif"];
Button["Show rose", rose]

does not return the image. I cannot get, why?

I can avoid the problem say, like this:

Button["Show rose", CreateDocument[rose, WindowSize -> {100, 100}]]

I post this question, since I would like to understand, what is wrong 
with simple operators like  Button["Show rose", rose] or Button["Show 
rose", Show@rose] or such a variant Button["Show rose", 
Import["ExampleData/rose.gif"]] and how should I choose right operators 
to be used inside the Button?

Regards, Alexei

-- 
Alexei Boulbitch, Dr., habil.
Senior Scientist

IEE S.A.
ZAE Weiergewan
11, rue Edmond Reuter
L-5326 Contern
Luxembourg

Phone: +352 2454 2566
Fax:   +352 2454 3566

Website: www.iee.lu

This e-mail may contain trade secrets or privileged, undisclosed or
otherwise confidential information. If you are not the intended recipient
and have received this e-mail in error, you are hereby notified that any
review, copying or distribution of it is strictly prohibited. Please inform
us immediately and destroy the original transmittal from your system. Thank
you for your co-operation.






  • Prev by Date: Re: use of a button
  • Next by Date: Re: Journals dying?, apparently rather slowly (was ,
  • Previous by thread: Re: use of a button
  • Next by thread: mathematica doesn't find periodic response with laplace transform