Is it possible to set a custom Y position on a tableView category row?

My tableView goes to the top of the devices screen but I want the category to stop a little below the top of the screen. I’ve snooped around 

tableView.\_view

and tried setting 

tableView.\_view.\_rows[3].y

where 3 is the category row, when it reached the spot I want it to stop. I also tried a few others but nothing worked.

Is this possible?

I guess what you mean is that your tableView goes to the top but when it encounters category row it won’t go to the top but will stop a little bit below right?

Then solution is simple on OnRowTouch add if statment, for example : (pseudo code)

for i=1 , #rows

if row[i].isCategory then

if row[i].y  > 600 then

stop Scrolling

end

end

end

If you want me to fix it for you submit your code since i am lazy bastard to implement this myself.

Ok say the top of my tableView is 0. The standard category row will stop when its top also reaches 0, but I want the category to stop at say 100 instead of 0.

Your method is similar to mine. The only way to get “rows” is by using 

tableView.\_view.\_rows

correct?

If so, it does change the y value of the row when I print it, but it doesn’t change the actual position of the row.

Also, onRowTouch only gets called when you touch or release a row. I think the tableView listener would be a better function to put it in since it gets called every time the tableView moves

Bump

The tableView is set to mimic the iOS native tableView where categories scroll up and stick to the top until the next category replaces them.  There are no controls to position this.

That said, widgets are an open source library on the Corona Labs github repository:  https://github.com/coronalabs/framework-widget

Feel free to download and modify to your heart’s content.

Rob

Thanks Rob. Downloaded the widgets and followed your post here http://forums.coronalabs.com/topic/34183-widgets-20-open-source/ but corona is still using the built in widget, not the new one. I’m not sure what I’m doing wrong

Nevermind, I don’t know what I did but I got it working.

To answer my original question, if you want the category to stop at 100 pixels then add “+ 100” to the following lines in widget_tableview.lua

804

self.\_currentCategory.y = self.\_currentCategory.contentHeight \* 0.5 + 100

839 & 840

if self.\_currentCategory and self.\_currentCategory.y ~= self.\_currentCategory.contentHeight \* 0.5 + 100 then self.\_currentCategory.y = self.\_currentCategory.contentHeight \* 0.5 + 100 end

870 -  Subtract instead of add

local rowTop = self.y + currentRow.\_view.y + view.\_height \* 0.5 - 100

881

self.\_currentCategory.y = currentRow.\_top - ( self.\_currentCategory.contentHeight \* 0.5  ) + 100

I guess what you mean is that your tableView goes to the top but when it encounters category row it won’t go to the top but will stop a little bit below right?

Then solution is simple on OnRowTouch add if statment, for example : (pseudo code)

for i=1 , #rows

if row[i].isCategory then

if row[i].y  > 600 then

stop Scrolling

end

end

end

If you want me to fix it for you submit your code since i am lazy bastard to implement this myself.

Ok say the top of my tableView is 0. The standard category row will stop when its top also reaches 0, but I want the category to stop at say 100 instead of 0.

Your method is similar to mine. The only way to get “rows” is by using 

tableView.\_view.\_rows

correct?

If so, it does change the y value of the row when I print it, but it doesn’t change the actual position of the row.

Also, onRowTouch only gets called when you touch or release a row. I think the tableView listener would be a better function to put it in since it gets called every time the tableView moves

Bump

The tableView is set to mimic the iOS native tableView where categories scroll up and stick to the top until the next category replaces them.  There are no controls to position this.

That said, widgets are an open source library on the Corona Labs github repository:  https://github.com/coronalabs/framework-widget

Feel free to download and modify to your heart’s content.

Rob

Thanks Rob. Downloaded the widgets and followed your post here http://forums.coronalabs.com/topic/34183-widgets-20-open-source/ but corona is still using the built in widget, not the new one. I’m not sure what I’m doing wrong

Nevermind, I don’t know what I did but I got it working.

To answer my original question, if you want the category to stop at 100 pixels then add “+ 100” to the following lines in widget_tableview.lua

804

self.\_currentCategory.y = self.\_currentCategory.contentHeight \* 0.5 + 100

839 & 840

if self.\_currentCategory and self.\_currentCategory.y ~= self.\_currentCategory.contentHeight \* 0.5 + 100 then self.\_currentCategory.y = self.\_currentCategory.contentHeight \* 0.5 + 100 end

870 -  Subtract instead of add

local rowTop = self.y + currentRow.\_view.y + view.\_height \* 0.5 - 100

881

self.\_currentCategory.y = currentRow.\_top - ( self.\_currentCategory.contentHeight \* 0.5  ) + 100