Cabbage Logo
Back to Cabbage Site

Knobman sliders

Wow! Thanks for this one! That’s simplest way i guess.But if you do strip instead of invidual images,it would be great!

Hi Rory, did you follow up on using a strip?

Not yet, but it’s on my list of things to do. I was thinking of adding an x and y offset identifier that we could use to scroll through an individual image. That should work Ok I think?

I would love to have this in cabbage. Using Flowstone for years, i’ve became quite a pro at Knobman and gui design. Please add this feature!

There seems to be quite a lot o support for this. It’s on the list. :wink:

1 Like

I’ve now have this implemented by adding a crop() identifier to the image widget. I went with the image widget rather than the slider to make things a little more generic. In the example shown below, I place a slider with alpha 0 on top of each image widget. The crop identifier forces the image widget to display only a small part of the source image. It’s then quite simple to dynamically set which part of the image to show using identifier channels().

Note that I would probably wrap this logic into a UDO if I was developing GUIs using this method. Note this is only implemented for .pngs for now.

That looks great!

When do you think this feature will be released?

Can you provide a zip of the project as well?

Matt

I will prepare new beta versions of Cabbage2 during the week. This csd will be in the examples. This feature will not make its way into the older version of Cabbage 1.n.

Awesome!

Thank you

BTW, cant wait for Cabbage2

What OS are you on? You can try it already. There are beta packages available.

i have both windows and osx.

Matt

Sweet. I’ll prepare new betas for both platforms later in the week. Just need to tidy up a few things first.

Perfect

Thank You!

Hey Rory,

Is there any way with the new Knobman slider feature to have the range different then 0 to 1. Attach is an example, one with the range at 0 to1 for the slider, but the other is a range of 0.32 to 3.2.

Please advise,
Matt

TestGui.zip (394.6 KB)

Sure, You just need to scale the values so as your slider moves from .75 to 5.75, you move through frames 0-30. Simple math is your friend:

iSlider4Min = .175
iSlider4Max = 5.75
filmStrip "sliderIdent4", int(((kvSlider4-iSlider4Min)/(iSlider4Max-iSlider4Min))*30)*145, 145, 145

The UDO that I wrote could also be updated to take these things into account. I just wrote it as a quick example. But it could certainly be modified and made more robust.

p.s. you mention a range of .32 to 3.2, but in your example it goes from .175 to 5.75?

Hello Rory,
What is the status of using knobman sliders and knobs ?
The example in the miscellanous section uses only one png file and on the first post, you talk about splitting the knoman file into several image.
Could you please update the tutorial ?
Many thanks

You don’t need to use multiple PNGs, although you still can if you want. I think it’s easier to use just the one, and use the crop identifier to determine what is actually seen at any one time. The example in the Misc folder had some absolute paths that were causing some display problems. I’ve fixed that now.

I start to understand what is the aim of each parameter in the crop function. Is the crop function documented somewhere?
Also, is it possible to use this technique with endless encoders?

My apologies, it doesn’t seem to have made it into the docs! I’ll sort that now. Yes, it can be used with an endless encoder. Crop takes 4 parameters, x, y, with and height. The idea here to to place a slider over an image. Then set the slider’s alpha value to 0 so that it is not seen. Then use crop() along with an identchannel with the image to display whatever part of the image you wish. The UDO in the example can be easily hacked. Let me know if you are finding it tricky to work with.

Just modified the UDO so that the value for the slider’s min/max gets normalized to 0 - 1

opcode filmStrip, 0,Siiikkk
	Sident, iframes, iWidth, iHeight, kval, kmin, kmax xin
	knorm = (kval - kmin) / (kmax - kmin) ; normalize min and max values to 0 - 1 range
	if changed(kval) == 1 then
		SMessage sprintfk "crop(0, %d, %d, %d)", int(knorm*iframes)*iHeight, iWidth, iHeight
		chnset SMessage, Sident
	endif
endop

this also changes the UDO call to something like

    iknobW = 50 ;knob width
    iknobH = 50 ; knob height
    iframes = 100 ; number of image frames
    
    
    filmStrip "rsliderIdent1", iframes, iknobW, iknobH, kchop, 0.03, 0.5

where 0.03 is the min and 0.5 is the max

1 Like