Table cell contents from last focus

I have a table with 3 rows. I want variable fun to be the contents of the row with focus for rows 2 & 3 defaulting to row 1. Works great. But, when I click outside the table and the table loses focus fun resets to the default, row 1. I’d like the value of fun to stick with the last focus row of the table. Any clues??

FT=FormulaTable
fun=      when FT.cellHasFocus(2,1) FT.cellContent(2,1)
otherwise when FT.cellHasFocus(3,1) FT.cellContent(3,1)
otherwise FT.cellContent(1,1)

Also, I’m happy to add a button that when pressed samples the table and assigns to fun, but I haven’t used buttons yet. Perhaps capture …

Are you having students input into table FT to see the result, or is it preset? If it’s preset, you could use a multiple choice instead.

Not sure if a button is a better solution for your intent here, but it will open some things up learning to use them. From your other posts, I don’t think they’ll be difficult to learn.

Just FYI, the first “otherwise” is unnecessary, you can just chain a whole bunch of when’s and only the final needs to be otherwise.

1 Like

Thanks for the otherwise tip!

I’m capturing student input. I’ve been banging my head on learning buttons, but can’t make it work. I’ve looked at online docs and searched for Desmos CL buttons and variations. Argh! I just don’t see how to assign a variable when the button is pressed.

I’m working on slide 8 in this activity. Students specify expressions that I turn into functions, and they give them names to appear in the graph. Works fine when there is focus on the table, but when they go to the graph to slide around m, I want their last (or button pressed) choice to be captured.

I would potentially go with Daniel’s suggestion of multiple choice, as you can use the table information to inform the label on the buttons.

See here (currently Slide 17) as an example - you’d probably want to adjust it but hopefully you can see the basic premise.

Big thanks! The slide is now well adjusted!