I figured out how to get an imageSheet to work with newSlider, sort of, but the problem is, it’s not using the dimensions I’ve specified. Code for the imageSheet and slider are below.
The widget 2.0 newSlider seems to not work with what I wanted my sliders to look like. With the old sliders, I was able to make them 50 px tall and 150 px wide, so I could update the value indicator text inside the slider area and not have to waste space having text on the outside. I also had special looking handles to follow the theme of my app.
Now it looks like the slider frame is limited to a certain height, like 16px? And the handle is pegged to a certain width? Probably I’m just not doing my image sheet correctly. Is it possible to have sliders with a height different from some standard height, and handles of different widths from some standard width?
local options = { -- array of tables representing each frame (required) frames = { -- FRAME 1: Handle Frame { x = 0, y = 0, width = 9, height = 54 }, -- FRAME 2: Left Frame { x = 9, y = 0, width = 2, height = 50 }, -- FRAME 3: Right Frame { x = 9+150-2, y = 0, width = 2, height = 50 }, -- FRAME 4: Middle Frame { x = 9, y = 0, width = 150, height = 50 }, -- FRAME 5: Fill Frame { x = 9+150, y = 0, width = 2, height = 50 }, }, -- optional params; used for dynamic resolution support sheetContentWidth = 161, sheetContentHeight = 54 } local sliderSheet = graphics.newImageSheet( "images/sliderSheet.png", options ) local mySlider = widget.newSlider{ top = firstButtonY, left = 10, width = 150, height = 50, value = 1, listener = mySliderListener, sheet = sliderSheet, leftFrame = 2, middleFrame = 4, rightFrame = 3, fillFrame = 5, handleFrame = 1, handleFrameWidth = 9, handleFrameHeight = 54 } gameGroup:insert( mySlider ) end