Problem with widget library being used as a library.

So i’m using the widget library as a module because I needed to make a change in the code to fit my needs.

The change I made was – 

view.\_onEvent( event, M.\_options.defaultFile )

On line 144 i belive.

The problem is if i have multiple widget.newButton’s then when i try to get the defaultFile for let say the second widget; it gets the file for the last one. Here’s an example. ( Not a working testing example )

function showImage( event, \_fileName ) if event.phase == "ended" then print(\_fileName) end end shortCut.addWidget( true, \_name, x, y, width, height, "imgs/Images/2.png", nil, showImage ) shortCut.addWidget( true, \_name, x, y, width, height, "imgs/Images/3.png", nil, showImage ) shortCut.addWidget( true, \_name, x, y, width, height, "imgs/Images/4.png", nil, showImage ) shortCut.addWidget( true, \_name, x, y, width, height, "imgs/Images/5.png", nil, showImage )

If i press on the one with “2.png” it still gives me the “5.png”

Thanks!

–SonicX278 

When you say “using as a module” do you mean you downloaded the entire widget.* source, modified it,  and are trying to use the modified source via ‘require’?

If so, as I recall, there is more to it than that.  I’ll wait for your response, and if you are indeed trying to use it this way I’ll see if I can point you in the right direction.

OK, I didn’t wait.  

This example will show you how to override widget.* with a locally downloaded and modified version:

http://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2016/03/override_widgets.zip

look in the ‘example’ folder for a main.lua and readme.txt

http://github.com/roaminggamer/RG_FreeStuff/tree/master/AskEd/2016/03/override_widgets/example

http://raw.githubusercontent.com/roaminggamer/RG_FreeStuff/master/AskEd/2016/03/override_widgets/example/main.lua

Well you take take a quick peak at this thread and i think you’ll see how i ended up doing it…

You can start reading from where @Renato started helping me.

https://forums.coronalabs.com/topic/62036-will-i-ever-be-able-to-pass-data-through-a-widgetnewbutton-function-call/

–SonicX278 

Sorry for the late response. My phone decided not to send me an email notification when you replied.

–SonicX278

But yes I did over ride it.( We’ll at least I believe so. )

The defaultFile parameter is being passed but not correctly.

–SonicX278

https://drive.google.com/file/d/0B-lP5LNKV6ewT2QwVGdndFVkOUk/view?usp=sharing

Check that out. I did a little edit in your example folder. See the “what i did.txt” file.

–SonicX278 

The local copy of widget library is NOT being used.

Looking into it.

Oh sorry. I figured it out. You can check my other post. Thanks for the example.code tho!!

-SonicX278

Download this again:

http://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2016/03/override_widgets.zip

Look at example 2, which I have verified uses local copy of widget library.

Great! I’ll check it out when I get home.

–SonicX278

When you say “using as a module” do you mean you downloaded the entire widget.* source, modified it,  and are trying to use the modified source via ‘require’?

If so, as I recall, there is more to it than that.  I’ll wait for your response, and if you are indeed trying to use it this way I’ll see if I can point you in the right direction.

OK, I didn’t wait.  

This example will show you how to override widget.* with a locally downloaded and modified version:

http://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2016/03/override_widgets.zip

look in the ‘example’ folder for a main.lua and readme.txt

http://github.com/roaminggamer/RG_FreeStuff/tree/master/AskEd/2016/03/override_widgets/example

http://raw.githubusercontent.com/roaminggamer/RG_FreeStuff/master/AskEd/2016/03/override_widgets/example/main.lua

Well you take take a quick peak at this thread and i think you’ll see how i ended up doing it…

You can start reading from where @Renato started helping me.

https://forums.coronalabs.com/topic/62036-will-i-ever-be-able-to-pass-data-through-a-widgetnewbutton-function-call/

–SonicX278 

Sorry for the late response. My phone decided not to send me an email notification when you replied.

–SonicX278

But yes I did over ride it.( We’ll at least I believe so. )

The defaultFile parameter is being passed but not correctly.

–SonicX278

https://drive.google.com/file/d/0B-lP5LNKV6ewT2QwVGdndFVkOUk/view?usp=sharing

Check that out. I did a little edit in your example folder. See the “what i did.txt” file.

–SonicX278 

The local copy of widget library is NOT being used.

Looking into it.

Oh sorry. I figured it out. You can check my other post. Thanks for the example.code tho!!

-SonicX278

Download this again:

http://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2016/03/override_widgets.zip

Look at example 2, which I have verified uses local copy of widget library.