# Unexpected behaviour within Manipulate

**URL:** <https://community.wolfram.com/t/unexpected-behaviour-within-manipulate/3426>\
**Category:** Questions\
**Tags:** mathematica\
**Created:** [September 25, 2014, 3:44pm UTC](https://community.wolfram.com/t/unexpected-behaviour-within-manipulate/3426 "2014-09-25T15:44:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jerico](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/jerico/32/18224_2.png) [@jerico](https://community.wolfram.com/u/jerico)\
**Post date:** [September 25, 2014, 3:44pm UTC](https://community.wolfram.com/t/unexpected-behaviour-within-manipulate/3426/1 "2014-09-25T15:44:02Z")

</div>

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!

Jesus

---

<div class="post-metadata">

**Author:** ![dreiss](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/dreiss/32/29094_2.png) [@dreiss](https://community.wolfram.com/u/dreiss)\
**Post date:** [September 25, 2014, 4:56pm UTC](https://community.wolfram.com/t/unexpected-behaviour-within-manipulate/3426/2 "2014-09-25T16:56:09Z")

</div>

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

```
Method->"Queued"

```

to your Button and all should be well…

---

<div class="post-metadata">

**Author:** ![jerico](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/jerico/32/18224_2.png) [@jerico](https://community.wolfram.com/u/jerico)\
**Post date:** [September 25, 2014, 5:05pm UTC](https://community.wolfram.com/t/unexpected-behaviour-within-manipulate/3426/3 "2014-09-25T17:05:10Z")

</div>

David  
Thanks indeed! It works as you have explained.

Regards

Jesus

---

<div class="post-metadata">

**Author:** ![gpalmerlv](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/gpalmerlv/32/2043_2.png) [@gpalmerlv](https://community.wolfram.com/u/gpalmerlv)\
**Post date:** [September 25, 2014, 5:16pm UTC](https://community.wolfram.com/t/unexpected-behaviour-within-manipulate/3426/4 "2014-09-25T17:16:51Z")

</div>

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.

```
Clear["Global`*"];

Manipulate[
Row[{Graphics@Disk[],Graphics[Text[Dynamic[filename],{0,0}],
 ImageSize->{200}]}],
 Button["Imagen?",filename=SystemDialogInput["FileOpen"]]]

```
