ID:1190088
 
(See the best response by Ter13.)
Code:
mob
Player
verb
allKnownRecipes()
var/recs=0 //Number of Recipes - used to define current cell number
for(var/obj/Recipe/Recipe in src.Recipes)
winset(src, "craft.recipeGrid","current-cell=[++recs]")
src << output(Recipe, "craft.recipeGrid")
winset(usr, "craft", "is-visible=true")


Problem description:

Basically, I'm not sure if this is even possible, but I thought I might as well ask. I create a grid using the code above, and populate it with "Recipes". A window pops up, holding the grid and two buttons (Accept and Cancel), and the player clicks on a Recipe, and then Accept, to choose one.

Is there any way of highlighting one by default (when the window opens), and if so, is there any way for the player to then navigate the grid (just up and down) with key presses?

Best response
Yes.

winset(handler.client,"filebrowserpanel.grid","style='body{background-color:#0000FF;color:#FFFFFF;}'")
handler.client << output(src,"filebrowserpanel.grid:[cell]")
winset(handler.client,"filebrowserpanel.grid","style='body{background-color:#FFFFFF;color:#000000;}'")


Basically, you set the style, which changes only the cells updated, then you change the cell's contents, then you change the style back to default.