Help Clearing Selection on gridview


Context : I'm working on my buttons for navigation.

Problem: I like the simplicity of gridview, but on a few of my screens I have a back button that I want to select. What I want is to scroll through my selections using the gridview, but when I press left it'll pass the selection over to the back button. Or rather, I clear the selected item in the grid view and fill the rectangle(my button).

In the demo you'll see me scrolling through my gridview options. Again though, I want to press left, tell it that if I've reached the far left option to deselect it and select back button. Telling the user they're no longer in the menu and can go back to another screen or something.

It feel like the SDK is forcing me to either use custom buttons, or gridview. Not a mix of both. I'm hoping for some incite on how to deal with this issue.


Just a bit of fiddling with the 'gridview' example... this seems to un-select (?):

function playdate.leftButtonUp()
	if selectedGrid == 0 then
       local section,row,column = gridview:getSelection()
       if column > 1 then
          gridview:setSelection(0,0,0) -- 'unselect' all cells
1 Like

that worked!!! I didn't even try that because I was thinking it would cause an error since there was no 0, 0, 0... Thank you so much @Tengu

1 Like