Ok so Im using a grid to control my inventory instead of teh stat panel because i want it in a different spot then the rest of the stat, my current code works fine except sometimes when your contents is empty and you add an item it doesnt update right and doesnt show the item until you get a second one. Im not sure what is wrong with it.
Code:
mob/proc/UpdateContents()
var/items = 0
for(var/obj/O in src.contents)
winset(src, "Inventory", "current-cell=1,[++items]")
src << output(O, "Inventory")
winset(src, "Inventory", "current-cell=2,[items]")
src << output(O.suffix, "Inventory")
winset(src, "Inventory", "cells=2x[items]")
Problem description: