newPickerWheel - alignment issues with records after first 5

Thanks for all the help. Sorry it took so long for me to implement the suggestions.

So I took the code from above an implemented into the project. I made a few minor tweaks. Here is the adjusted code.

local widget = require( "widget" ) local function new(params) local columnData = { { -- Day align = "right", width = 140, startIndex = 4, labels = { "Sun Oct 23","Mon Oct 24","Tue Oct 25","Wed Oct 26","Thu Oct 27", "Fri Oct 28", "Sat Oct 29", "Sun Oct 30" }, }, { -- Hours align = "center", width = 50, startIndex = 8, labels = {"1","2","3","4","5","6","7","8","9","10","11","12"} }, { -- Mins align = "center", width = 50, startIndex = 30, labels = {"01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","00"} }, { -- Am/Pm align = "center", width = 40, startIndex = 1, labels = {"AM","PM"} } } local wheel = widget.newPickerWheel({ columns = columnData, x = display.contentCenterX, y = display.contentCenterY }) local function remove() print("I would like to remove my self") end end return {new=new} 

Same results. the initial five rows are correct.  Last three records are off. If you scroll to end then back to top then first three records, which were aligned correctly original, are now off. I am going to try and remove the call from the fieldView call back closer to the UI class and see what I get.

So I made the call from the view class and the wheel is still off. There must be some event internal to the wheel which displays the rows not initially shown. Some where in there my code must have stepped on the alignment. The fields are inserted onto the display through use of another class… So if I understand things correctly my UI widget stack is 

Sceen --> from base Corona

    View -> from framework View.lua

        TextField -> from framework FieldView.lua

            PickerWheel -> from test.lua

I have bypassed the textField class. Here is the View.lua

-- View.lua local View = Class( ) local widgetFactory = require( 'widget' ) function View:initialize( ... ) self.view = display.newGroup() self.fields = ... end function View:loadScreen( screen, dataModel ) if( dataModel ) then local eventWidgets = {} local rowCount = 1 local rowKeyX = 50 local rowValX = 190 local scrollView = nil if ( (#dataModel\*rowKeyX) \> display.contentHeight ) then print( 'I need to scroll!' ) scrollView = widgetFactory.newScrollView { width = display.contentWidth, height = display.contentHeight, scrollWidth = display.contentWidth, scrollHeight = 0,--#dataModel \* rowKeyX, horizontalScrollDisabled = true, backgroundColor = { 0, 0, 0 }, listener = handleScroll } end for i, kv in ipairs( dataModel ) do local label, field = unpack( kv ) print( tostring( scrollView ) ) if( scrollView ) then display.newText( scrollView, label, rowKeyX, (50\*rowCount), nil, 17 ) else display.newText( screen, label, rowKeyX, (50\*rowCount), nil, 17 ) end -- native.newTextField( centX, centY, width, height ) --[[local obj = native.newTextField( rowValX, (50\*rowCount), rowValX, 24 ) obj.text = field obj.size = 17 eventWidgets[label] = obj ]]-- rowCount = rowCount + 1 end return eventWidgets end end function handleScroll( event ) local phase = event.phase if ( phase == "began" ) then print( "Scroll view was touched" ) elseif ( phase == "moved" ) then print( "Scroll view was moved" ) elseif ( phase == "ended" ) then print( "Scroll view was released" ) end -- In the event a scroll limit is reached... if ( event.limitReached ) then if ( event.direction == "up" ) then print( "Reached top limit" ) elseif ( event.direction == "down" ) then print( "Reached bottom limit" ) elseif ( event.direction == "left" ) then print( "Reached left limit" ) elseif ( event.direction == "right" ) then print( "Reached right limit" ) end end return true end return View

Hi @rbentley,

You must still have some other module or code base which is overriding the core Corona widget library. Or, you are doing something else that is pinpointing or tweaking the labels.

If I copy your exact code from the post above (where you did not use the “view” class), and I run it in a new/blank Corona project, the picker looks perfect to me. No mis-alignment issues whatsoever.

I’m using the latest public build for testing: 2016.2992.

Best regards,

Brent