ID:140011
 
Code:
mob/verb/Buy1()
winshow(usr, "Buy", 1)
src.UpdateBuy()
// var/list/Items=new
// Items+=new /obj/box
// for(var/obj/O in src)
// winset(src, "Buy.Price", "current-cell=[++Items]")
// src << output(O, "Buy.Price")

mob/proc/UpdateBuy()
var/list/Items=new

Items+=new /obj/box
Items+=new /obj/cone
Items+=new /obj/cylinder
Items+=new /obj/pyramid
for(var/obj/O in Items)
Row++
winset(src, "Buy.grid1:1,[Row]", "current-cell=[++Items]")
src << output(O, "Buy.grid1:1,[Row]")
winset(src, "Buy.grid1:,[Row]", "cells=[Items]") // cut off any remaining cells
winset(src, "Buy.Price", "text=\"[cost]") // cut off any remaining cells


Problem description: i cant it work like it should like it dont select the item can some one help me fix this

Once UpdateBuy() ends, the objs are being destroyed, because there is no reference to them anywhere in the code, and being present in an interface control doesn't count. You'll need to store the Items list somewhere external to the proc so you maintain a reference to protect them from the garbage collector. So, for example, make it mob/var/list/Items.
In response to Garthor
Garthor he is asking for how does he make it so if some one click on the item to buy then it tell you the price of the product in the label called price and also when he clicks buy button then he can buy the product which is selected.