Jump to content

Setting gridlist row's texts


Tete omar

Recommended Posts

Posted

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 ?

Posted

I don't really understand you correctly, that's why I'll ask you if you want this:

You have a table with texts, and you want to insert all these texts in your grid list, but what is the 1 to 15 for-loop doing there?

Posted
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.

Posted

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 

Posted

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 

Posted

Thanks ,

@Castillo

thanks but i see the gridlist's items have added twice , btw , the Gridlists table has a 2 gridlists , so i think the 15 items has been added twice in the 2 gridlists that means 15 and more 15 items with the same name.

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...