widget.newSearchField ?

Since its open source and public already guess its ok to ask here. I finally caved in and got a copy of the widget 2.0 code to peek under the hood. I was trying to see how I might be able to address a scrollview question I had and I came across this little undocumented gem : widget.newSearchField

It appears to be working in the latest daily builds so perhaps its not something that will disappear anytime soon. Anyone from Corona Labs care to say a few words about this widget? 

Thanks much!!! Regards,

Kerem

I allready try it, and find only two bugs.

  1. The blinking pipe overlap the magnifying glass

  2. If you insert the SearchField in a ScrollView, and click in the SearchField, the event go through to the scroll view, and nothing happens (the keyboard don’t show up)

Regards

For #1 try textFieldXOffset = 10 etc in the options table. 

For #2 I didn’t get that far yet. Trying to get all the options figured out. 

CL any official word? 

Hi Kerem,

Sure, tinker around with this to your heart’s content. :slight_smile: We just haven’t officially rolled it out… 

Brent

Hi Brent, is it in the plan to officially roll it out at some point? That would be awesome!!! Thank you very much. 

Yes, it is, but it probably won’t happen in the immediate future. First we need to make sure all of the existing widgets are working bug-free and offer users the expected OS-like behavior associated with them. Once that is cleared, there will probably be some new widgets going to the factory.

Brent

Super. That sounds great. 

Oh and, I’m glad I don’t have to flee to Russia and file for asylum.

Please don’t cancel my passport to the Corona SDK nation!  :slight_smile:

Same finding here. Wonder how I can let scrollView pass touch / tap events through to the newSearchField… It is looking great otherwise.

Ok. I moved my code to do away with scrollView on this screen. Now I have a tableView which normally shows a list of records and now I insert the newSearchField on row 1. Row 2 onwards contain my records.

The following is my ORT for the tableView. I tweaked it to detect row.index == 1 which means my searchField was tapped and if row.index > 1 then a record was tapped so I go to the detail page for that record etc. 

Now the question is how can I change the ORT to pass the touch down to the newSearchField’s listener if row.index == 1. Can anyone fathom a guess? Thanks much for your help.

-- Handle touches on the row local function onRowTouch( event ) local phase = event.phase local row = event.target if event.phase == "press" then print( "Pressed row: " .. row.index ) elseif event.phase == "release" or event.phase == "tap" then print( "Tapped and/or Released row: " .. row.index ) row.reRender = true if row.index == 1 then -- this is the searchBox - pass control to its listener -- I need something to go in here to pass control to the search field's listener. else storyboard.gotoScene( "scn\_detail" ) end end end

Anyone have any ideas? I keep reading all I can find on the documents library but can’t seem to sort this one out. Appreciate any help you might be able to provide. Thank you . 

Ok. I think I made some progress… newSearchField normally has a parameter called listener in the options table but it is perhaps not working as intended yet. Putting the following line right after the point where newSearchField is defined gets me a good listener that triggers : 

newSearchField : addEventListener(“touch”, searchListener)   

my listener looks very brief and like this : 

-- The listener for our searchBox local function searchListener( event ) local phase = event.phase print( "object touched = ", event.target ) --'event.target' is the touched object print ("searchListener - ", phase) return true end 

When I run my app now I do see my tableView scrolling and behaving as I expect in rows 2 through n which are the data rows. When I tap or touch row 1 which is the searchField row I now see that my listener is getting the event as I see 

searchListener -     began     and 

searchListener -     ended

in my terminal! Wohoo!!! Making progress. Now how do I get the newSearchField to process these events internally so we move forward to the ‘editing’ phase? I don’t understand why the newSearchField widget isnt’t catching these events when its implanted in a table as it does when its simply inserted into a regular page, ie a display group. 

I know this is yet to be released and therefore unsupported code but any idea you might have will be still very much appreciated. Thank you very much!

Hmmm, I saw 

  • Mac: Fixed bug introduced in daily build #1053 where offscreen TextFields and TextBoxes cannot receive the keyboard focus and will not provide “userInput” events. casenum: 24464

in today’s daily build Notes and got excited thinking this might help with the newSearchField widgets textbox not popping up issue but sadly it does not… I am still stuck with this one. It would be so awesome if this widget was finished up alongside other fixes that I hope are still happening. 

Nice!

I will be waiting to implement the search widget into an App I’m working on. Now, I’m using the native textfield and everything is fine, but a display object will be a plus.

I allready try it, and find only two bugs.

  1. The blinking pipe overlap the magnifying glass

  2. If you insert the SearchField in a ScrollView, and click in the SearchField, the event go through to the scroll view, and nothing happens (the keyboard don’t show up)

Regards

For #1 try textFieldXOffset = 10 etc in the options table. 

For #2 I didn’t get that far yet. Trying to get all the options figured out. 

CL any official word? 

Hi Kerem,

Sure, tinker around with this to your heart’s content. :slight_smile: We just haven’t officially rolled it out… 

Brent

Hi Brent, is it in the plan to officially roll it out at some point? That would be awesome!!! Thank you very much. 

Yes, it is, but it probably won’t happen in the immediate future. First we need to make sure all of the existing widgets are working bug-free and offer users the expected OS-like behavior associated with them. Once that is cleared, there will probably be some new widgets going to the factory.

Brent

Super. That sounds great. 

Oh and, I’m glad I don’t have to flee to Russia and file for asylum.

Please don’t cancel my passport to the Corona SDK nation!  :slight_smile:

Same finding here. Wonder how I can let scrollView pass touch / tap events through to the newSearchField… It is looking great otherwise.