جرب
GUIEditor = {
gridlist = {},
window = {},
button = {}
}
GUIEditor.window[1] = guiCreateWindow(217, 37, 369, 454, "", false)
guiWindowSetSizable(GUIEditor.window[1], false)
GUIEditor.gridlist[1] = guiCreateGridList(59, 52, 268, 194, false, GUIEditor.window[1])
guiGridListAddColumn(GUIEditor.gridlist[1], "asd", 0.9)
for i = 1, 3 do
guiGridListAddRow(GUIEditor.gridlist[1])
end
guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "صورة رقم واحد", false, false)
guiGridListSetItemText(GUIEditor.gridlist[1], 1, 1, "صورة رقم 2", false, false)
guiGridListSetItemText(GUIEditor.gridlist[1], 2, 1, "صورة رقم 3", false, false)
ImgTable = {
{ "img1", "img1.png" };
{ "img2", "img2.png" };
{ "img3", "img3.png" };
-- { "imgName, "filePath" };
};
img = guiCreateStaticImage ( 55, 270, 267, 174, "img1.png", false );
guiSetVisible ( img, false );
for i, v in ipairs ( ImgTable ) do
local row = guiGridListAddRow ( gridlist );
guiGridListSetItemText ( gridlist, row, 1, v [ 1 ], false, false );
guiGridListSetItemData ( gridlist, row, 1, v [ 2 ] );
end
addEventHandler ( "onClientGUIClick", root,
function ( )
if source == gridlist then
if guiGetVisible ( img ) == false then guiSetVisible ( img, true ); end
local filePath = guiGridListGetItemData ( gridlist, guiGridListGetSelectedItem ( gridlist ), 1 );
if filePath and filePath ~= "" then
guiStaticImageLoadImage ( img, filePath );
end
end
end
)