ID:139545
 
grid1 has the "flexible list of entries" box checked.

The UpdateGrid() verb:
mob
verb
UpdateGrid()
if(winget(src, "button1", "is-checked")=="true")
for(var/obj/Items/I in src)
src << output(I, "grid1")
if(winget(src, "button2", "is-checked")=="true")
for(var/obj/JutsuCards/J in src)
src << output(J, "grid1")
if(winget(src, "button3", "is-checked")=="true")
for(var/mob/M in world)
src << output("[M.key]([M.name])", "grid1")

Adding an obj to src.contents at Login():
// ...
src.contents += new/obj/JutsuCards/Rashoumon
src.contents += new/obj/JutsuCards/Sharingan_One
// ...


So when I run the game, it only shows the "Sharingan One" icon and name. (unless the jutsu button (button2) is selected by default, which it is sometimes and I don't know why, then it shows Rashoumon until I click the button again) I want it to show all the JutsuCards in the contents...why isn't this working? Thanks!
mob
proc
UpdateGrid()
var/R = 1
src << output("Name","Grid:1,1")
for(var/obj/JutsuCards/A in src.contents)
R++
src << output(A.name,"Grid:1,[R]")


This is a way to do it, there are much better ways if i'm not wrong.
In response to Ocean King
Hmm, now it always shows the Sharingan under everything else in the grid, even when the "Who" button is pressed, it shows my key/name, and then the Sharingan...
In response to Hi1
Clear the grid when updating it.

winset(src,"Main.Grid","cells=0x0")
In response to Ocean King
Wow, I should have been able to figure that out. :P
Thanks, but for some reason the atom icon(s) flicker when clicked now...

EDIT: And not just once, they keep flickering...
In response to Hi1
Set the "cells" parameter based on the size of your grid.

Modified Ocean King's example:
mob
proc
UpdateGrid()
var/R = 1
src << output("Name","Grid:1,1")
for(var/obj/JutsuCards/A in src.contents)
src << output(A.name,"Grid:1,[++R]")
winset(src, "Grid", "cells=1,[R]")

This removes flicker because it automatically replaces old cells with the new objects, and it also trims off any extra cells that shouldn't be filled.
In response to Kaiochao
Kaiochao wrote:
Set the "cells" parameter based on the size of your grid.

Modified Ocean King's example:
> mob
> proc
> UpdateGrid()
> var/R = 1
> src << output("Name","Grid:1,1")
> for(var/obj/JutsuCards/A in src.contents)
> src << output(A.name,"Grid:1,[++R]")
> winset(src, "Grid", "cells=1,[R]")
>

This removes flicker because it automatically replaces old cells with the new objects, and it also trims off any extra cells that shouldn't be filled.

It still seems to flicker, but I guess that's because it's clearing the cells and then filling them back. I fixed it by adding another proc and only updating the grid when needed, I had a loop updating the grid every second...thanks guys!