[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sc-devel] EZSlider mapping drags



Hi James,

On Dec 3, 2007 7:38 AM, James Harkins <jamshark70@xxxxxxxxx> wrote:
>
> I tend to think that users might be confused or startled by full error
> messages resulting from GUI actions. So, if there's a good chance of an
> error (say, by somebody dragging the wrong kind of object in), I prefer to
> wrap the action in a try block and, if needed, present a user friendly
> warning rather than a panic inducing error.
>
>
>  sliderView.receiveDragHandler = { arg slider;
>  try { slider.valueAction = controlSpec.unmap(SCView.currentDrag) }
>  { |error|
>  if(error.notNil) { "Cannot drag \"%\" into EZSlider."
>  .format(SCView.currentDrag).warn
>  };
>  };
>  };
>

This is handled by SCNumberBox. It will just silently ignore non
number drops (or drag ins).

> Also, maybe I missed something, but if you start dragging when the mouse is
> inside a slider view, isn't it supposed to invoke the slider's action? Which
> is...
>
>
>  sliderView.action = {
>  value = controlSpec.map(sliderView.value);
>  numberView.value = value.round(round);
>  action.value(this);
>  };
>

valueAction is needed in order to update the number box control; Only
the slider value is set if we call action.


> What functionality does the slider drag action add?
> hjh
>

beginDragAction maps the control's native range to the spec's mapped value.

		sliderView.beginDragAction = { arg slider;
			controlSpec.map(slider.value)
		};

without this, we would be dragging unmapped values (in the range of
0-1) out from the slider.

x

>
> On Dec 3, 2007, at 1:01 AM, blackrain wrote:
>
>
> Hi all, the following small addition maps drags to and from controls
> in EZSlider.
> can please someone add this?
>
> SCViews2.sc @ 177
>
>  sliderView.receiveDragHandler = { arg slider;
>  slider.valueAction = controlSpec.unmap(SCView.currentDrag);
>  };
>
>
>  sliderView.beginDragAction = { arg slider;
>  controlSpec.map(slider.value)
>  };
>
>
> thanks
>
> x
> _______________________________________________
> Sc-devel mailing list
> Sc-devel@xxxxxxxxxxxxxxx
> http://www.create.ucsb.edu/mailman/listinfo/sc-devel
>
>
>
>
>
> : H. James Harkins
>
> : jamshark70@xxxxxxxxxxxxxxxxx
>
> : http://www.dewdrop-world.net
>
> .::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:
>
>
>
>
> "Come said the Muse,
>
> Sing me a song no poet has yet chanted,
>
> Sing me the universal."  -- Whitman
>
> _______________________________________________
> Sc-devel mailing list
> Sc-devel@xxxxxxxxxxxxxxx
> http://www.create.ucsb.edu/mailman/listinfo/sc-devel
>
>