TakeFocus from a button to it's corresponding TableView

Good Day,

I was wondering on how can I takeFocus from my Button to my TableView?

my code works fine with scroll View, I was wondering how can I do it in TableView, apparently my code does not work for table View, here it is: this is the listener for my button:

local buttonHandler(event) local phase = event.phase local self = event.target if phase == "began" then display.getCurrentStage():setFocus( event.target ) dx = event.xStart dy = event.yStart elseif phase == "moved" then local dy = math.abs( ( event.y - event.yStart ) ) local dx = math.abs( ( event.x - event.xStart ) ) if ( dy \> 10 ) then myTableView:takeFocus( event ) end end end

Thank you in advance

tableView doesn’t support takeFocus(). You’ve got a couple of options. First you could download the open source version of the widget library (It’s all Lua) and add a takeFocus() method to the tableView object (probably could make use of the one in scrollView without too much difficulty.) or you can file a feature request and get it voted up:

https://feedback.coronalabs.com

and have us add it to the library. I think it would be beneficial to have this in our version, but that’s just my opinion. This will be the slower process to getting it added.

Rob

Here is the repo for the widgets
https://github.com/coronalabs/framework-widget/blob/master/widget_theme_ios.png
Edit: wrong link, here is the right link https://github.com/coronalabs/framework-widget

@Rob Miracle, are there any reasons why it is not included in the TableView widget? so that I will know :slight_smile:

I am not going to speaks for rob but i am sure you know that the table view is build on top of the scrollview. I am guessing stacking an objects over touch sensitive rect might cause so issues. Another and probably the best reason it was not what the table view was build for. It is many used for select from a list, not to put a bunch of moving object on top of.

tableView doesn’t support takeFocus(). You’ve got a couple of options. First you could download the open source version of the widget library (It’s all Lua) and add a takeFocus() method to the tableView object (probably could make use of the one in scrollView without too much difficulty.) or you can file a feature request and get it voted up:

https://feedback.coronalabs.com

and have us add it to the library. I think it would be beneficial to have this in our version, but that’s just my opinion. This will be the slower process to getting it added.

Rob

Here is the repo for the widgets
https://github.com/coronalabs/framework-widget/blob/master/widget_theme_ios.png
Edit: wrong link, here is the right link https://github.com/coronalabs/framework-widget

@Rob Miracle, are there any reasons why it is not included in the TableView widget? so that I will know :slight_smile:

I am not going to speaks for rob but i am sure you know that the table view is build on top of the scrollview. I am guessing stacking an objects over touch sensitive rect might cause so issues. Another and probably the best reason it was not what the table view was build for. It is many used for select from a list, not to put a bunch of moving object on top of.