3
$\begingroup$

Bug introduced in 10.1.0 and fixed in 10.2.0

I've confirmed, with WRI, that an issue was introduced in version 10.1 with regard to initializing Manipulator Dynamic values when the Manipulator is wrapped in a DialogInput.


Here, I'm asking for help in creating a work-around. The slightly modified code snippets I've included are from a larger notebook. But, they show the issue.

The following code shows the initialization of the Manipulator when not wrapped within a DialogInput:

DynamicModule[{val = 75.0},
  Print[val]; (* Print for Debug *)
  Column[{Manipulator[Dynamic[val], {50, 100, 0.2},
  Appearance -> {"Open", "Labeled"},
  AppearanceElements -> {"InputField", "StepLeftButton", "StepRightButton"}]}]
]

The above works fine with the Manipulator being initialized to 75., even in version 10.1.

The following is the code that will not propagate the initialization value to the Manipulator inside a DialogInput using version 10.1, but worked in prior versions. Note that the Manipulator is initialized to 50., not 75.:

DynamicModule[{val = 75.0},
  DialogInput[
    Print[val]; (* Print for Debug *)
    Column[{Manipulator[Dynamic[val], {50, 100, 0.2}, 
      Appearance -> {"Open", "Labeled"}, 
      AppearanceElements -> {"InputField", "StepLeftButton", "StepRightButton"}],
       Row[{DefaultButton[DialogReturn[{Today, Round[val, 0.2]}]], CancelButton[]}]}],
  WindowTitle -> "Input Value"]
]

In the actual code, the initialization value for val is from a file, not hard-coded. Can anyone think of a work-around that will allow me to get an initialization value into the Manipulator that works in version 10.1? It may not be possible, but I'm looking for something relatively simple that doesn't require modifying any system files.

To address some questions in the comments:

I should have mentioned that I'm running Win 8.1, 64-bit. Maybe it's specific to that OS version. I did get confirmation from WRI that they were able to reproduce my problem.

The purpose of the code is simply to be able to open a DialogInput with a slider initialized to a piece of data read from a file. If desired, manipulate the slider to a new value and return that value along with the date. If my current approach is not a good one, I'm open to better ideas.

$\endgroup$
1
  • $\begingroup$ I am on v. 10.1.0 on Win7-64bit. I execute your dialog code and get a slider initialized to 75. If I then close the control without touching the slider, then reopen it, the value gets reset to 50, i.e. the min value for the control range. On the other hand, if I move the slider around first, then close it and reopen it, it does not get reset. I had seen this behavior in many other cases within my own Manipulate as well, and brushed it off as a sporadic annoyance, but it appears to be systematic. Thanks for bringing this up with WRI! $\endgroup$
    – MarcoB
    May 8, 2015 at 17:16

1 Answer 1

2
$\begingroup$

I wass going to post an answer about scoping issues but it seems that this problem can be narrowed down.

As MarcoB has noticed, there appears to be a bug in Manipulator.

var = 75;
Manipulator[Dynamic[var], {50, 100, 0.2}]

when you open it, var is reset to 50...

If you start with "Open" it is ok. However, if you put `Manipulator to dialog, each option has issues.

This lead me to the conclusion that it is related to those bugs:

And indeed it is, moving/resizing of the window affects this.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.