Another Pictslider Question
So I’m basically trying to replace an LCD with a pictslider, as pictslider has the ability to output a non one-to-one pixel ratio (IE a pictslider of screen width 200 can output 0 to 1000 in the same range, and mouse tracking can be adjusted).
But, another part of my patch really needs to know when the user is dragging/clicking on the thing, and there’s no outlet for that like there is in LCD.
I’m toying with using Mousestate and some If/then statements, to basically only output mouse information if the cursor is in the correct screen area, but this seems like it will likely have a lot of unforeseen circumstances. For instance, when dragging the pictslider, mousestate gets incorrect numbers from the mouse, since the OS cursor is actually being centered on screen, and not tracking directly with the pictslider knob.
dragging = any change of output value.
when the mouse scale in not 1, just scale
the values likewise.
clicking = more difficult. when you need
mouseover position or when you click on
the same pixel in the pictslider twice,
you have a problem.
Yeah, clicking is the problem – ideally I need mousedown vs mouse up.
|MuShoo wrote on Mon, 04 May 2009 03:59|
|Yeah, clicking is the problem – ideally I need mousedown vs mouse up.|
btw, i forgot … in some old projects i used a simple
method which might work for you here.
create your pictslider as usual, but then put an
ubutton over it, which is creating the actual data.
it will be some work to recreate the ubutton output
to give it a slider function, but at least it has
mouse down mouse up by default.
I’d actually toyed with that idea yesterday a little, but I abandoned it because it didn’t seem to output data smoothly enough (and I lost the high resolution of pictslider). I think I figured out a workaround, though. Hard to explain in under like, a page, though.
This is amazing good advice. 2 reasons:
1: You get raw output which is good if you’d like to change the behavior of the object.
2: It’s irked me that I force UI objects to redraw twice if I have some set up where I take the output of an object, send it to the rest of the program and then the program decides to update the value. its one think if its a number box, it’s another if its a huge slow JSUI. I think this is standard MVC behavior.
there is a third thing which i am doing when using the
ubutton trick: the ubutton is light on CPU-for-GUI – as
it does not display anything.
so the data can get much faster from the mouse to
where it is needed, all you have to do make sure
the ubutton output goes first to the aim and then
to the slider graphics behind it.
behind the rtl trigger there is also the place for
a [defer] or a [pipe 0.] when needed.
the fourth advantage using ubutton comes to play
when you need more than one GUI object to display
the stuff you would like to see. (for example 2
not sure about "smoothly" – it could be that
ubutton is 50ms and other objects are 20. i never
noticed a difference but that doesnt mean there is
none. just make sure you convert properly from
int to int range.
that means stay awas from [zmap 1. 100. 0. 250.],
use [scale] or [expr].
I’m not sure whether you have this sorted or not, but I thought it was interesting so I had a go.
Heres a pictslider patch that will show mouse-down and x-y values only when the mouse is inside pictslider. Is that what you needed?
Might not be as cpu-freindly as using a scaled ubutton instead of pictslider, but it seems to work.
edit : just realised it might also be useful to have a mouse-over for each pictslider
heres the changed patch, hope its useful
----------begin_max5_patcher---------- 1857.3oc6bsrjahCEcs6uBJxxwoKjPhGyrZ9Alpl0olpKrQsalfAWf5NclT4 ee.IAVXCFwKaSGVDvHdn68n68nWmz+3gU5ahemjpq86ZeQa0pe7vpUrhxKXk 35U568deanWJ6wzodazWyK+MujHu8jhhgEkevit8kfncOkP1R4eajA9Qi0Z. 9QKS9E1OZn8OhW543HZ4W6OSB7BK9bA9rxh27ue1tnrMwI9jj3nswgwI7pvH +ad7.P5aSIuSq7j.jqAbcs+33awqC0pgWx7+JOo05JGjrkSdPGrgqy5Z+wwW J508AQgDJqI.HgXoA+GCw.vLKhW71vfsesZs.Dlq3f7W9k32HImZS1Efw4+n hME+JsvnLKZ6SHojHpGMHNpR6OhU81xPnLlHhA0A5kkx+5zuefHtWPDUeslN 6eRH+YMtF.WKv5F90otdme67W9mO7P9g0JlybHXKMMLHKZptTm76dwbGSVVC hm6XXTdpzSjxPrzqKjAVaaFrk1LSVaFp91rMecWjueh2N4PxlZxxO0KjqY1l K.XfQgqA.VHatyIaV3MtDsQGXM.8f035P.rMd+dRToelC6rxyrnTxmyaIzNG kpAMvNLf.B3.AlcBZzURAG8djjTE+LtLqK1AwMTXUZ29PdFuaWH4RfBVFTfm iIRdt6E87ptHnEWDWuKdoXnIH3wO9aQZAQoYQNcKFBwigrv8KFBXb0BhPCOH pILjiVZuq4E4q881G9h.0b.8DzfSNnIFuyX.ZY06lKFJgbky75KaDvb3fRaC Bzs64pY78a7h1oOQPm4n.cnoG5Lu1PG4aYt1YYpGzRou97ysSrI5UDY1SH0Z 3PpoR7Z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r L8CTEZH33wldKjh2nfAF20XPe0TWg7WFll5LcFOM0snNtE0w8Ko53ZXblPGW 93LA0FCsnqtEc0snqtEc0snqt4jt55lr5flKxpqCxpqappChWTU2hp5VTU2h p5VTU2hp5VTU2uNppyZVtGvyyctdlJSf4pnLloZfYtp4n4pFulqZpadpfwYq dQmo5yclJG54p5y+vK1e3hp5teUUWgxUTQUcP7MUAOCRebP3nnON7DplgQVo aruT048wQ4SyzEXcsyyqjduotbqL.9ySrOMoFm0LfKmgL1.UdUCgDcwXMZyX QcyXGnIkOZDXaljUGwOrCCwrQ7Uhi+es8pWw+S5J1kisH6AisLirUOw4pBt. kZvs6H55hjiNssjVMGwUP9NghsXOI6pwvSZKOysaNhkgEOLgI9AKweePqdkv srFsTvb0L0pizQ9BHP1QJTQa0qDJlvdbcj1hsf3N5IFxwV.G4XKwUhXKgmLF wVLOo0LW70MyEnfMY1Q1DfkLuHvUlWr3JNuXQ6vXvKpPXBx35BtJjBhfcDaM k6yF.ZHOK6he9v+CP8uiu -----------end_max5_patcher-----------
Thanks, Tim! The mouseover feature is pretty great, this is exactly what I need! If it ends up being to slow I’ll fall back to my workaround, but I think this should be fine.