Jump to content

Setting gridlist row's texts


Tete omar

Recommended Posts

Hello , i'm having a problem with this code

for i,v in pairs(Gridlists) do 
    local column=guiGridListAddColumn(v,"Column",85) 
    for g = 1, 15 do 
        local row=guiGridListAddRow(v) 
            for k,c in ipairs(Texts) do 
                guiGridListSetItemText(v,row,column,c,false,false) 
            end 
    end 
end 

This code will make a 15 rows into the gridlists which is into the "Gridlists" table , and the 'Texts' Table is containing all texts which should be in the 15 different rows , but i only see the fourth item which is in the table has included all rows which is in the given gridlists, what do i do ?

Link to comment
Hello , i'm having a problem with this code
for i,v in pairs(Gridlists) do 
    local column=guiGridListAddColumn(v,"Column",85) 
    for g = 1, 15 do 
        local row=guiGridListAddRow(v) 
            for k,c in ipairs(Texts) do 
                guiGridListSetItemText(v,row,column,c,false,false) 
            end 
    end 
end 

This code will make a 15 rows into the gridlists which is into the "Gridlists" table , and the 'Texts' Table is containing all texts which should be in the 15 different rows , but i only see the fourth item which is in the table has included all rows which is in the given gridlists, what do i do ?

The 'Texts' table is for every row , let's guess we made a 3 rows

Texts = {"Item1","Item2","Item3"}

row1's text will be "item1"

row2's text will be "item2"

row3's text will be "item3"

I hope you understand.

Link to comment

Try this:

for i,v in pairs ( Gridlists ) do 
    local column = guiGridListAddColumn ( v, "Column", 85 ) 
    for k, c in ipairs ( Texts ) do 
        local row = guiGridListAddRow ( v ) 
        guiGridListSetItemText ( v, row, column, c, false, false ) 
    end 
end 

Link to comment

At a glimpse I noticed every row's would have item15 written due to the fact that it's always overwritten

for i,v in pairs(Gridlists) do 
    local column=guiGridListAddColumn(v,"Column",85) 
    for g = 1, 15 do 
        local row=guiGridListAddRow(v) 
        guiGridListSetItemText(v,row,column,Texts[i],false,false) 
    end 
end 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...