Pickerwheel picks wrong value

I ended up with something like this:

[lua]

local function onRequireWidgetLibraryAlso(name)

    return require(“framework-widgets-master.” … name)

end

package.preload.widget_theme_ios = onRequireWidgetLibraryAlso

package.preload.widget_theme_ios_sheet = onRequireWidgetLibraryAlso

package.preload.widget_theme_android = onRequireWidgetLibraryAlso

package.preload.widget_theme_android_sheet = onRequireWidgetLibraryAlso

– Override Corona’s core widget libraries with the files contained in this project’s subdirectory.

– Argument “name” will be set to the name of the library being loaded by the require() function.

local function onRequireWidgetLibrary(name)

    return require(“framework-widgets-master.widgetLibrary.” … name)

end

package.preload.widget = onRequireWidgetLibrary

package.preload.widget_button = onRequireWidgetLibrary

package.preload.widget_momentumScrolling = onRequireWidgetLibrary

…[/lua]

So that I could put everything in one folder. However, this does not appear to solve the issue. I added print statements to line 273 and 280 of the pickerwheel code to see if it was being called, so far, no print statements. Can you confirm that the print statement should work?

Cheers,

Mourdos

Just copy everything that’s *inside* framework-widgets-master to your local directory, and my original code should work. You’ll have problems otherwise because of the skin inclusion you are doing above.

Alex

That worked, cheers Alexf,

I had to add a bit more to the _yposition than just the 20 it was adding itself from self._top, I added up needing to raise it by 15 to 20. Now I just need to make sure it doesn’t trigger @jsh_apple’s problem.

Thanks,

Mourdos

Worked for me as well, thanks.

Hi, this is not working with me. i copied all files to local directory but still getting nil

 package.preload.widget_theme_ios = nil
package.preload.widget_theme_ios_sheet = nil
package.preload.widget_theme_android = nil
package.preload.widget_theme_android_sheet = nil

– Override Corona’s core widget libraries with the files contained in this project’s subdirectory.
– Argument “name” will be set to the name of the library being loaded by the require() function.
local function onRequireWidgetLibrary(name)
    return require(name)
end
package.preload.widget = onRequireWidgetLibrary
package.preload.widget_button = onRequireWidgetLibrary
package.preload.widget_momentumScrolling = onRequireWidgetLibrary
package.preload.widget_pickerWheel = onRequireWidgetLibrary
package.preload.widget_progressView = onRequireWidgetLibrary
package.preload.widget_scrollview = onRequireWidgetLibrary
package.preload.widget_searchField = onRequireWidgetLibrary
package.preload.widget_segmentedControl = onRequireWidgetLibrary
package.preload.widget_spinner = onRequireWidgetLibrary
package.preload.widget_slider = onRequireWidgetLibrary
package.preload.widget_stepper = onRequireWidgetLibrary
package.preload.widget_switch = onRequireWidgetLibrary
package.preload.widget_tabbar = onRequireWidgetLibrary
package.preload.widget_tableview = onRequireWidgetLibrary

 
 
  --==========================================
  local widget = require( “widget” )
  widget.setTheme( “widget_theme_ios” )

Before more people are tempted to waste time on this: I pulled source from Github, did steps to ensure the downloaded widget library is evaluated on calls to require(“widget”), yet the problem appears not to be fixed. A call to pickerWheel:getValues() returns widely variable results  - the expected (and indeed documented) behaviour is seldom seen. 

EDIT: Getting better results if the pickerWheel is added to the scene at the top level, and not as part of a display group.

This is the first time I’ve seen this – can someone from Corona Labs confirm this SHOULD or MUST be done when using the widget library from Github???

 Jay

Alex, can you explain that?  I’ve found that I can just copy the widgets.lua out of widgetLibrary to my main folder and rename it to like widgets2.lua and then just require “widgets2” and it works.  I suppose you could also do require("widgetLibrary/widgets)

Of course that doesn’t mean I’m doing it right.

If I’m doing it wrong it’s your fault, Rob, since I followed your example. :wink:

Maybe all this time I’ve thought it was working but it was really just using built-in widget stuff (although bug fixes did seem to be happening that were put into Github).

 Jay

I’m pretty sure it was running the files in widgetLibrary like it should 'cause of the plethora of print statement’s I added :slight_smile:

Jay,

Rob is perfectly right. The code i posted is just the way of including the widget lib as require(“widget”) instead of “widget2” and making extra sure it gets included from the local directory.

In a normal case scenario, requiring “widget2” suffices.

@runeb: the patch for having the picker in a display group is very specific to the user that reported the bug. Until further improvement to the component, if you place it into a display group you will get some funny results. I’m already working on a solution.

Thanks,

Alex

Halelujah. Welcome back Alex!!!  :slight_smile:

Worked for me as well, thanks.