ID:1801435
 
(See the best response by Lummox JR.)
Code:
mob
proc
OpenStatsTab()
if(HSO)
winshow(client,"stats",0)
else
for(var/obj/Techniques/O in contents)
winset(client,"techniques.grid1",O)
winshow(client,"techniques",1)


Problem description:
Basically, I'm trying to show the persons techniques in the interface tab, that'll pop up and I'm trying to make it look as organised as possible, can someone help me and tell me how to put Grids in there to make it look neater. ( Will be very appreciated, Thank you a lot. )
You're using winset() where you should be using output(). The winset() proc alters parameters of the control. output() sends something to the control to display. However you would need more info to output to a grid, such as the column and row.
In response to Lummox JR
So let's say the icon is there, name of the object and suffix of the object. How would I make it so it automatically puts itself in columns and grids.
Best response
The suffix won't display automatically this way (you'd need to throw it into another column). Let's say you want two columns: one with the icon and name, one with the suffix.

winset(player, "mygrid", "cells=2x[mylist.len]")
for(var/i=1, i<=mylist.len, ++i)
var/obj/item = mylist[i]
player << output(item, "mygrid:1,[i]")
player << output((item&&item.suffix), "mygrid:2,[i]")

First the grid is changed to the size it needs to be to hold all of the items. This is optional because the grid will grow as needed, but if you didn't do this at the beginning you'd want to do it at the end, to trim off any excess rows left over from the last time the grid was used.

For each object, the object itself--which includes both icon and name if you told the grid to show the names of objects--goes into column 1 of row i. The suffix goes into column 2 of that same row; I did a trick with && to make sure it will output null (clear the cell) if the object is null.
In response to Lummox JR
Thanks, i'm just trying to analyse the code and see how it works because, this is so not my area XD. Thanks for the help now, I have to just learn how to incorporate it into my system and BAM, I'll have a grid system, I can use for everything :P
In response to Lummox JR
Sorry to bother you but, I was just wondering if this was correct
mob
proc
OpenStatsTab()
if(HSO)
winshow(client,"techniques",0)
else
var/list/mylist = new/list
for(var/obj/A in contents) mylist.Add(A)
winset(client, "techniques.grid1", "cells=2x[mylist.len]")
for(var/i=1, i<=mylist.len, ++i)
var/obj/techniques = mylist[i]
client << output(techniques, "techniques.grid1:1,[i]")
client << output((techniques&&techniques.suffix), "techniques.grid1:2,[i]")
winshow(client,"techniques",1)
Well, you don't need the mylist var, since you can just use contents directly as long as you don't have any mobs in your contents. If that's a concern, though, then there's no harm in copying the list.

As far as I can tell that code looks good.
                winset(src, "skillsgrid", "cells=1x[src.skills]")
for(var/i=1, i<=src.skills, ++i)
var/gui/skills/skill = src.skills[i]
src << output(skill, "skillsgrid:1,[i]")


Everything seems to be working fine but I'm getting some run time errors.

http://prntscr.com/6tv9oe
Shouldn't this:

for(var/i=1, i<=src.skills, ++i)


be this:

for(var/i=1, i<=src.skills.len, ++i)
In response to FKI
I don't know but it causes errors when that's done.
If you could post all the relevant code, that'd be nice. That change I pointed out is necessary because you were comparing i, a number, to src.skills, a list. Now, at least, you should make it inside the loop safely.
The Skill Template
gui
parent_type = /obj
skills

The Grid
            update_skills()
winset(src, "skillsgrid", "cells=1x[src.skills]")
for(var/i=1, i<=src.skills.len, ++i)
var/gui/skills/skill = src.skills[i]
src << output(skill, "skillsgrid:1,[i]")


Hopefully that's nice enough fer ya.
I also noticed in your call to winset in update_skills() that you're doing the same thing as noted in my last post.

Other than that, I don't see anything outright wrong. If you could reproduce the error in DEBUG mode, that might help. Then post the error with problem line of code. Compiling with #define DEBUG somewhere, or alternatively, going into your environment's preferences, will do it. I find the latter more preferable.
In response to FKI
I copy pasted what lummox did when it came to that winset. I know how winset works but not really paying attention to what it's doing in this code. However it seems to have nothing to do with the runtime error I found that out by simply turning it into a comment with "//".
In response to Neonkyojin
Is the skills variable initialized?
In response to FKI
I guess so.
mob
player
var
skills=list()
If you could reproduce the error in DEBUG mode, that might help. Then post the error with problem line of code. Compiling with #define DEBUG somewhere, or alternatively, going into your environment's preferences, will do it.

Do the above for me and post the output + the problem code. There's something missing and I don't think it's available here (or it's evading us pretty well).
In response to FKI
I did that nothing changed.
In response to Neonkyojin
Neonkyojin wrote:
I did that nothing changed.

Well where's the output then?
In response to FKI
At my moms house forgot to bring it

http://prntscr.com/6tw2y7
Page: 1 2