Using the SMDoubleSlider code

Open Source License issues

Be sure to read and abide by the license accompanying this distribution. The license explicitly states what you can and cannot do.

Add the code to your project

You need to add either the SMDoubleSliderIB3Framework or all four of the SMDoubleSlider.h/.m and SMDoubleSliderCell.h/.m files to your application. I won't give explicit directions on how to do that here. Check in the Xcode Help if you need some assistance.

Use the double slider classes

Usually, you will use Interface Builder to put a double slider into a nib file. Hook up your target action (or bindings). You can also create a double slider at run time using the -initWithFrame: method.

You could also assign a table column to contain double sliders by using the SMDoubleSliderCell class and NSTableColumns -setDataCell: method. Here's an example of how you could use it. In the example, myTableView is a variable of type NSTableView.

SMDoubleSliderCell *cell;
cell = [ [ [ SMDoubleSliderCell alloc ] init ] autorelease ];
[ cell setMinValue:5 ];
[ cell setMaxValue:10 ];
[ [ myTableView tableColumnWithIdentifier:@"sliderColumn" ] setDataCell:cell ];

Note: I've never tried to make a column of double sliders. I'm not sure how they would be able to get both low and high values from the table data source. It'd probably need some kind of dictionary with a low value and high value keys that could be passed by the table to SMDoubleSliderCells -setObjectValue: method. Of course, the -setObjectValue: method would then need to check for a dictionary class and grab those two keys (if they exist). If anybody implements this and tests it, please send it back so I can include it in the main source.

© 2003-2008 Snowmint Creative Solutions LLC (Last Updated 2008-01-24)