widget.newButton 2013.1034 brakes build

Danny, cool, I appreciate the feedback, thanks.

I missed the info earlier. I keep forgetting I am user Corona800 :slight_smile:

/BK [import]uid: 144955 topic_id: 36199 reply_id: 143779[/import]

Idk where I got into my head that newTextField and newTextBox was going to be made into Widgets… I guess it’s a little wish of mine and I thought the Widgets 2.0 would include some new widgets. So it was just an assumption. I’ll be happy in v2.01 when the radio issue gets fixed. Meanwhile I will still campaign for votes here: http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/3577682-widgets-to-replace-native-textbox-and-textfield [import]uid: 58885 topic_id: 36199 reply_id: 143786[/import]

ahhh… widgets 2.0 have so many changes to the structure! tableView for instance is like a rewrite now for me.

-Matt [import]uid: 18783 topic_id: 36199 reply_id: 143788[/import]

local videoList = widget.newTableView{top=44,height=385}  
 local videos = {}  
 videos[1] = { isCategory=true, name="Audio Lectures" }  
 videos[2] = { name="Admin Of Estates 1", go=showVideo1}  
 videos[3] = { name="Admin Of Estates 2", go=showVideo2}  
 videos[4] = { name="Introduction", go=showVideo3}  
  
 local function onRowTouch(event)  
 local row = event.target  
 local rowGroup = event.view  
 if event.phase == "press" then  
 if not row.isCategory then rowGroup.alpha = 0.5; end  
  
 elseif event.phase == "release" then  
  
 if not row.isCategory then  
 -- reRender property tells row to refresh if still onScreen when content moves  
 row.reRender = true  
 videos[event.index].go()  
 end  
 end  
  
 return true  
 end   
  
 local function onRowRender(event)  
 local row = event.target  
 local rowGroup = event.view  
 local isCategory  
 if row.isCategory then  
  
 local rowText = display.newText( videos[event.index].name, 12, 0, native.systemFontBold, 18 )  
  
 rowGroup:insert(rowText)  
  
 end   
 if not row.isCategory then  
 local listText = display.newText(videos[event.index].name,12, 0, native.systemFontBold,18)  
 listText:setReferencePoint(display.CenterLeftReferencePoint)  
 listText.y = row.height \* 0.45  
 listText:setTextColor( 0 )  
 -- local subTitle = display.newText(videos[event.index].subtitle, 12, 0, native.systemFont,12)  
 -- subTitle.y = row.height \* 0.78  
 -- subTitle:setTextColor(0)  
 local arrowImage = display.newImage("arrow.png")  
 arrowImage.x = 300  
 arrowImage.y = row.height \* 0.55  
 rowGroup:insert(listText)  
 -- rowGroup:insert(subTitle)  
 rowGroup:insert(arrowImage)  
 end   
  
 end  
 for i = 1, #videos do  
 local rowHeight, rowColor, lineColor, isCategory  
 if videos[i].isCategory then  
 isCategory = true  
 rowHeight = 24  
 rowColor={ 150,160, 180,200 }  
  
 end  
 videoList:insertRow{ onEvent=onRowTouch, onRender=onRowRender, height=rowHeight, isCategory=isCategory, rowColor=rowColor, lineColor=lineColor }  
 end  
  
 group:insert(videoList)   
 end  

So this code worked perfectly before the switch to the new daily build with the revamped widgets…
I can fiddle with it and get the tableview to show with lines but it does not read the index of the videos from the table at all…
Any thoughts on this… as I said this codes works fine right up to the latest build with the new widget 2.0 announcement.

Matt [import]uid: 18783 topic_id: 36199 reply_id: 143795[/import]

@Danny, it looks like the new widget is not allowing me to do this:

myButton.onRelease = myFunction

I dynamically change the onRelease property of widget buttons at runtime based on app’s state of things. Is it a regression bug? Or it is being overlooked in the migration document? This makes the widget buttons unresponsive in my app.

Naomi [import]uid: 67217 topic_id: 36199 reply_id: 143797[/import]

@Naomi: The new widget library was intentionally designed to abstract you from it’s internal properties and methods, to prevent overriding methods/properties.

I don’t recommend doing this but to get you out of a spot you should be able to achieve the same behaviour via:

myButton.\_view.onRelease = onRelease  

@mattchapman:

I believe this change should fix it for you:

  
-- Change  
videos[event.index]  
  
-- To  
videos[row.index]  
  

[import]uid: 84637 topic_id: 36199 reply_id: 143799[/import]

Since you took away take:Focus this no longer works for me.
[lua]
if dx > 5 or dx < -5 then
scrollBox:takeFocus( event )
end
[/lua]
I was changing the focus from the touched object to the scrollView. How do I do this now? [import]uid: 46082 topic_id: 36199 reply_id: 143800[/import]

@danny
That certainly helped… I also had to change local row = event.target to local row = event.row
and for some reason drop all code pertaining to local rowGroup = event.view and rowGroup:insert(object)… also all the rows had to have this… local listText = display.newText(row,videos[row.index].name,12, 0, native.systemFontBold,18)
meaning they had to have row, in front where it did not before.

That said… for some reason it still isn’t right… how do I keep the arrow image in each row. That currently is just putting the arrow at the top of the screen whereas before the code inserted it into each row.

Matt

[import]uid: 18783 topic_id: 36199 reply_id: 143803[/import]

@mattchapman:

event.view was the same as rowGroup internally before thats why it was removed. Also rowGroup was the same as event.target (which was the row group). So there were a lot of variables that did the same thing.

Inserting into event.row is what you should be doing. Does that work for you? [import]uid: 84637 topic_id: 36199 reply_id: 143807[/import]

@Danny, thank you. I reverted my code back and using daily 1030 for now.

That said, I think it would be useful if you could add a way to reset onRelease property much the same way we could dynamically change the Label by using ButtonWidget:setLabel( labelText )

In other words, any chance for adding ButtonWidget:setOnRelease( func )? I’d rather not have multiple of buttons piled up on top of each other (enabling and displaying only one at a time based on the state of the app.) I think it’s so much better if we can change the behavior of a button using set function of some sort. If not, I will go with the *unrecommended* approach you suggested above.

Naomi [import]uid: 67217 topic_id: 36199 reply_id: 143811[/import]

@Naomi:

Given the new structure of the widget library, adding a method like you suggested would make sense.

Obviously there are always going to be some teething problems, but we are totally open to adding or changing things to benefit the users :slight_smile: [import]uid: 84637 topic_id: 36199 reply_id: 143813[/import]

I’m in the same boat with this as well @sXc with the takeFocus being removed.

Really could do with a quick answer on this if you could please.

Cheers [import]uid: 179960 topic_id: 36199 reply_id: 143818[/import]

@Icy Spark:

Can you give me some use case examples for needing setFocus? I just want to get a sense of what you guys require and how you expect it to work.

Thanks [import]uid: 84637 topic_id: 36199 reply_id: 143828[/import]

Like I mentioned in post #26. If I press a button in my game to drag it or whatever and my finger goes more than X number of pixels I need the focus to switch to the background or a different object. [import]uid: 46082 topic_id: 36199 reply_id: 143829[/import]

@Danny

I have a scrollView full of buttons (icons that are small versions of the images I want to put onto the screen)

Its a kids app, so having a scrollView of well over 200 images is the most sensible way to go about it.

As there are hundreds of images in the scrollView, I need to be able to swipe up and down to go through the images. Once I see one I like I press the button and it shows a larger version on screen.

So the takeFocus worked in that if you press the button but swipe up or down the focus would be returned to the scrollView and I could carry on viewing the hundreds of images. If you didnt swipe it would press the button. [import]uid: 179960 topic_id: 36199 reply_id: 143835[/import]

@danny
yes changing that fixed the arrow image in my code above…

I notice that the touch response is much better now with widget 2.0… the old version which is in all my apps pretty much sometimes you had to press and hold to get it to fire. It is much smoother now.

2 things in my code above.

The category seems to stay the same size as the rows even though the code says to make it smaller…
and
I am noticing that if you touch the category when some touchable event is under it , it will fire that…return true or not. I think this has something to do with rowGroup.alpha section of the rowRender function.

matt
[import]uid: 18783 topic_id: 36199 reply_id: 143969[/import]

@mattchapman:

Glad to hear it!

Regarding your questions.

#1: Did you check out the listView 1 or 2 sample code ? It shows categories being smaller in height than the tableView rows.

#2: That could be a bug, if you would be so kind as to file a bug here: http://developer.coronalabs.com/content/bug-submission

That way I can keep track of it and ensure it gets fixed (if it is indeed a bug) as soon as possible.

@Everyone:

Note: To everyone, this thread has become very hard to track for me, there are several different things being discussed that don’t relate to the original topic. In order to make this cleaner, if everyone could post in either:

A) A similar topic that relates to the problem you are facing (ie tableView topic for tableViews, button for buttons)

or

B) Create a new topic if one doesn’t already exist with your issue.

I will leave this thread open but if you all wouldn’t mind branching out from it to keep things clean that would be great.

Thanks for all the feedback thus far, the quicker I know about any bugs or issues, the faster I can get them resolved for everyone. [import]uid: 84637 topic_id: 36199 reply_id: 143972[/import]

Hi,
I’ve the same issue ā€œERROR: widget.newButton: theme data file expected, got nilā€ because I don’t know how to recreate my custom theme file.
Where can I find the syntax of custom theme file ?
I checked in ā€œV2 migration guideā€ but didn’t find anything about theme file.

Hope you’ll be able to give me a solution as soon as possible.

Thanks
David [import]uid: 223645 topic_id: 36199 reply_id: 144305[/import]

@david.dantoni.

My plan is to get a theming guide out this week.
Apologies for any inconvenience caused and thank you for your patience. [import]uid: 84637 topic_id: 36199 reply_id: 144308[/import]

I renewed my license ($199) to get hold of the widgets 2.0 upgrade. To my dismay, my scrollview problems have gotten worse. My images no longer show in the scrollview. Come on guys… this is ridiculous. I CANNOT release my app with the scrollview broken. What’s the ETA on getting scrollview fixed? [import]uid: 29817 topic_id: 36199 reply_id: 144500[/import]