Pickerwheel picks wrong value

Hey alexf,

Sorry to continue to be a pain about this, (apple are being a bigger pain with their week long maintenance that stops us getting profiling sorted >.>) but its been two weeks since you said very soon. Can you confirm the status of this fix please?

Cheers,

Mourdos

Hey Mourdos,

You’re not being a pain at all. This has been fixed about 12 days ago but it’s kind of a hack. For that reason, we did not include it in the daily builds. I updated the github repo though to contain that fix as well, so if you would be so kind to clone it and integrate it into your project, you will see that your picker works.

The repo is at https://github.com/coronalabs/framework-widgets

Thanks,

Alex

If I include this as a module in my program, this means that it will no longer benefit from any later work you do to widgets?

Edit: Also, can you tell me how I go about integrating this? Do I need to add it as a module into my project, or do I need to place it into a corona engine folder?

Cheers,

Mourdos

You get the framework from the above url, and copy all the files to your main dir (the one containing main.lua).

In your main.lua, before any include statement for the widget library, you do:

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("widgetLibrary." .. 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

And you are set.

Regarding the future work on widgets, any changes to the widget framework will be reflected in the github copy. Even if sometimes it takes a few days to update the github repo, they will be kept in sync.

Hope this helps,

Alex

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

I posted a bug 25115 very similar to this and still not working on daily build 1170. Actually you can “position” the picker wheel between 2 values. You get a “nil” when trying to get the value.

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:

Hey alexf,

Sorry to continue to be a pain about this, (apple are being a bigger pain with their week long maintenance that stops us getting profiling sorted >.>) but its been two weeks since you said very soon. Can you confirm the status of this fix please?

Cheers,

Mourdos

Hey Mourdos,

You’re not being a pain at all. This has been fixed about 12 days ago but it’s kind of a hack. For that reason, we did not include it in the daily builds. I updated the github repo though to contain that fix as well, so if you would be so kind to clone it and integrate it into your project, you will see that your picker works.

The repo is at https://github.com/coronalabs/framework-widgets

Thanks,

Alex

If I include this as a module in my program, this means that it will no longer benefit from any later work you do to widgets?

Edit: Also, can you tell me how I go about integrating this? Do I need to add it as a module into my project, or do I need to place it into a corona engine folder?

Cheers,

Mourdos

You get the framework from the above url, and copy all the files to your main dir (the one containing main.lua).

In your main.lua, before any include statement for the widget library, you do:

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("widgetLibrary." .. 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

And you are set.

Regarding the future work on widgets, any changes to the widget framework will be reflected in the github copy. Even if sometimes it takes a few days to update the github repo, they will be kept in sync.

Hope this helps,

Alex