Mefisto_PL Posted January 4, 2012 Share Posted January 4, 2012 How can I make GUI grid list to show when I click the name of item messages in Memo. I want make a names of items and messages in file.xml. So can anybody help me? : Link to comment
myonlake Posted January 4, 2012 Share Posted January 4, 2012 viewtopic.php?f=91&t=38466 Link to comment
Mefisto_PL Posted January 4, 2012 Author Share Posted January 4, 2012 to gridlist is working too? Link to comment
Castillo Posted January 4, 2012 Share Posted January 4, 2012 You want when you click on a gridlist it'll display some text in the GUI memo? Link to comment
Castillo Posted January 4, 2012 Share Posted January 4, 2012 This is a simple example: --We create a table with two items on it. local dataTable = { ["Dog"] = "Ugly", ["Cat"] = "Nice", } myGridList = guiCreateGridList(382, 221, 200, 201, false) --We create our GUI gridlist. guiGridListAddColumn(myGridList,"",0.70) --We add a column to our gridlist. for question, answer in pairs(dataTable) do --We loop through our "dataTable". local row = guiGridListAddRow(myGridList) --We add a row to our gridlist. guiGridListSetItemText(myGridList,row,1,tostring(question),false,false) --We set the column text to the data obtained from the table. guiGridListSetItemData(myGridList,row,1,tostring(answer)) --We the column data as the "answer". end myMemo = guiCreateMemo(591,221,175,53,"",false) --We create our GUI memo. addEventHandler("onClientGUIClick",myGridList, function () local row,col = guiGridListGetSelectedItem(source) --We get the gridlist selected item.. if (row and col and row ~= -1 and col ~= -1) then --We check if the row and column is valid.. local answer = guiGridListGetItemData(source, row, 1) --We get the selected item data (the answer).. guiSetText(myMemo, answer) --We set the our memo text with the text obtained above. else --If row and column aren't valid... guiSetText(myMemo, "") --We our memo text to nothing. end end, false) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now