Message Boards Message Boards


Unexpected behaviour within Manipulate

Posted 9 years ago
3 Replies
1 Total Likes

Community Members As a part of a larger interface, I added a button within a Manipulate to display an specific picture. In order to explain better I have written the following code:

Manipulate[{f, name}, {{f, Graphics[Disk[]]}, 
  ControlType -> None}, {{name, "filename"}, ControlType -> None}, 
 Button["Imagen?", name = SystemDialogInput["FileOpen"]]]

I have initializated variables f and name with a circle and filename, respectively. At first, theses variables are display properly but filename does not updates after choosing a filename clicking on the button "Image?" I do not know why is this? Thanks for any help!


3 Replies
Posted 9 years ago

I had not seen the reply when I wrote this. I don't see a delete button, so moderator, please delete this post.

The following may not be very helpful, but it does update the filename. I also had trouble overriding the initialization, so I didn't initialize it.


POSTED BY: Gary Palmer

David Thanks indeed! It works as you have explained.



This is a classic problem! Buttons (and some other dynamic things) are set up by default to preempt other evaluations that may be underway but also to only assume that it will take a specific maximum amount of time. Generally when using SystemDialogInput and other things that will take longer than this, the action will time out and nothing then happens. This is all controlled by the Method Option to Button.

"With the default setting Method->"Preemptive", button actions are performed immediately, preempting any other evaluation, but are allocated only a limited time to complete."

So add


to your Button and all should be well...

POSTED BY: David Reiss
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract