Difference between Internal Widgets and Github Widgets?

I’m using Corona build 2014.2155 and when I try to use the current widget framework from Github I’m getting this error message:

Runtime error ?:0: attempt to perform arithmetic on field '\_oldAnchorX' (a nil value) stack traceback: ?: in function '\_calculatePosition' ?: in function \<?:1457\> (tail call): ? /Users/jay/Library/Application Support/Outlaw/Sandbox/590/widgetLibrary/widget.lua:135: in function \</Users/jay/Library/Application Support/Outlaw/Sandbox/590/widgetLibrary/widget.lua:122\> (tail call): ? /Users/jay/Library/Application Support/Outlaw/Sandbox/590/main.lua:163: in function 'setUpDisplay' /Users/jay/Library/Application Support/Outlaw/Sandbox/590/main.lua:216: in main chunk

If I switch to using the internal widget library the error doesn’t happen.

Is that a known problem? If so, is there a fix scheduled for the widget library on github?

Not sure how feasible it would be, but maybe you guys (Corona Labs) could link to the github library for your builds? That way it would be kept up-to-date automatically.

 Jay

I’ll check with Engineering.  This is the first report of that problem with the github version of the widget library that I’m aware of. 

As far as keeping them in sync, I think we’ve only put out a few fixes since the last time it was updated. We don’t have an automatic sync process in place right now.  I’m not sure what’s involved with it, but I’ll ask engineering.

Rob

Hey Jay,

I strongly believe there is something going on with your code specifically. Could you please put together a quick bug report? The error comes from the graphics 2.0 mode constructor, which only gets called if the graphicsCompatibility flag is off. From your error it sounds like the g2.0 constructor gets called on a v1 compatibility mode-enabled project, so i need to see some code in order to be able to help.

Thanks,

Alex

Alex, I submitted the code as Case 30331 – thanks for any light you can shed on this. (And if it’s my fault, I apologize in advance for wasting your time).

 Jay

FYI I believe I had the same error a week or so ago (using the latest-at-the-time daily build and the latest-at-the-time github widget library), so it’s not just JA. This was with Graphics 2.0 _not_ in compatibility mode.

It was also discussed as a bug on December 29 here, with no resolution:

http://forums.coronalabs.com/topic/42751-bug-with-recent-builds-and-git-framework-widget-code-for-widgetnewbutton-error-oldanchorx/

I didn’t have time to debug it so reverted, sigh, to the included widget library that has a different set of problems.

This error appears if you put the widget code in a sub-folder. The problem is that all the requires in the widgets source will still load the internal widgets and thus widgets.lua that you include sets its _oldAnchorX property but another widget that requires widgets.lua will call the internal widgets which don’t have this property set. Either put the widget source in your project root dir or change all the requires in the widget source to “yourWidgetFolder.someWidget”.

I’ll check with Engineering.  This is the first report of that problem with the github version of the widget library that I’m aware of. 

As far as keeping them in sync, I think we’ve only put out a few fixes since the last time it was updated. We don’t have an automatic sync process in place right now.  I’m not sure what’s involved with it, but I’ll ask engineering.

Rob

Hey Jay,

I strongly believe there is something going on with your code specifically. Could you please put together a quick bug report? The error comes from the graphics 2.0 mode constructor, which only gets called if the graphicsCompatibility flag is off. From your error it sounds like the g2.0 constructor gets called on a v1 compatibility mode-enabled project, so i need to see some code in order to be able to help.

Thanks,

Alex

Alex, I submitted the code as Case 30331 – thanks for any light you can shed on this. (And if it’s my fault, I apologize in advance for wasting your time).

 Jay

FYI I believe I had the same error a week or so ago (using the latest-at-the-time daily build and the latest-at-the-time github widget library), so it’s not just JA. This was with Graphics 2.0 _not_ in compatibility mode.

It was also discussed as a bug on December 29 here, with no resolution:

http://forums.coronalabs.com/topic/42751-bug-with-recent-builds-and-git-framework-widget-code-for-widgetnewbutton-error-oldanchorx/

I didn’t have time to debug it so reverted, sigh, to the included widget library that has a different set of problems.

This error appears if you put the widget code in a sub-folder. The problem is that all the requires in the widgets source will still load the internal widgets and thus widgets.lua that you include sets its _oldAnchorX property but another widget that requires widgets.lua will call the internal widgets which don’t have this property set. Either put the widget source in your project root dir or change all the requires in the widget source to “yourWidgetFolder.someWidget”.

Anyone have luck resolving this? Having the same issue. Have tried the solutions recommended here, but no luck.

@steve16 Read my previous post. There is another posibilitiy of overloading the widget new functions that will let you use the github version it is however more complicated. Anyway you want to go if the widget source is not in your project root dir you have to write or change some code.

Here’s a tutorial on overriding specific widgets from atanas:

http://widgetstown.com/selectively-add-widgets-in-your-projects/

Note that using only part of widgets from github can break in new builds.

Primoz, thank you for your help. I really appreciate it. Just to confirm, I moved my widget files directly in my project’s root directory, but I’m still getting the same error. The odd thing is the project runs fine with my custom tableview widgets. The problem happens as soon as I add a single scrollview to the same scene, then I get this error:

attempt to perform arithmetic on field '\_oldAnchorX' &nbsp;

For scroll view to work with the github source you need 3 files in your project root dir.

widget.lua, widget_scrollview.lua and widget_momentumscrolling.lua. If you have all 3 it should work.

If you rename any of the files or move them to a subfolder it will break.

Thank you again, Primoz! I did have all three of those files in my root directory BUT I had changed the name of widget to widgets with an s on the end and that was making the scrollview break. Without your hint, I would have never noticed. Thank you. All is good now. At least until the next roadblock.

Thank you.

Anyone have luck resolving this? Having the same issue. Have tried the solutions recommended here, but no luck.

@steve16 Read my previous post. There is another posibilitiy of overloading the widget new functions that will let you use the github version it is however more complicated. Anyway you want to go if the widget source is not in your project root dir you have to write or change some code.

Here’s a tutorial on overriding specific widgets from atanas:

http://widgetstown.com/selectively-add-widgets-in-your-projects/

Note that using only part of widgets from github can break in new builds.

Primoz, thank you for your help. I really appreciate it. Just to confirm, I moved my widget files directly in my project’s root directory, but I’m still getting the same error. The odd thing is the project runs fine with my custom tableview widgets. The problem happens as soon as I add a single scrollview to the same scene, then I get this error:

attempt to perform arithmetic on field '\_oldAnchorX' &nbsp;

For scroll view to work with the github source you need 3 files in your project root dir.

widget.lua, widget_scrollview.lua and widget_momentumscrolling.lua. If you have all 3 it should work.

If you rename any of the files or move them to a subfolder it will break.