I’m trying to reset the value of a MD Slider upstreams via code. “Visually” the MD slider is reset to desired starting position (0.5, 0.5) but I’m not receiving that Value back from its output. Only after I poke on it with the mouse, the value that was set is emitted from the MD slider.
Why is that?
The code which did reset the slider (pictured above) which still is stuck on (0.48, -0.57, 0) despite the fact that the slider’s handle was moved to the middle:
RunScript
{
var input = Component.Params.Input[0];
m_mdslider = input.Sources[0].Attributes.DocObject as Grasshopper.Kernel.Special.GH_MultiDimensionalSlider;
if (Reset)
{
var ghdoc = Component.OnPingDocument();
var _call_reset = new GH_Document.GH_ScheduleDelegate(Callback_Reset);
if (ghdoc != null && _call_reset != null)
ghdoc.ScheduleSolution(1, _call_reset);
}
} // end RunScript
// < Custom additional code >
Grasshopper.Kernel.Special.GH_MultiDimensionalSlider m_mdslider;
private void Callback_Reset(GH_Document doc)
{
// reset to middle
var _pt = new Point3d(0.5, 0.5, 0.0);
m_mdslider.Value = _pt;
m_mdslider.Attributes.ExpireLayout();
//m_mdslider.Attributes.PerformLayout();
m_mdslider.OnDisplayExpired(true);
Component.ExpireSolution(false);
}
So how can I poke on the slider to make it yield the value it should have according to the value that was set?
// Rolf