Mischief-1 Posted April 12, 2024 Posted April 12, 2024 Hello everyone! How do I disable horizontal gridlist scroll? I want to have it only scrolling vetically. GUIEditor = { gridlist = {}, window = {}, button = {} } addEventHandler("onClientResourceStart", resourceRoot, function() local screenW, screenH = guiGetScreenSize() GUIEditor.window[1] = guiCreateWindow((screenW - 544) / 2, (screenH - 401) / 2, 544, 401, "Vehicle & Tend Finder", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetAlpha(GUIEditor.window[1], 0.77) GUIEditor.button[1] = guiCreateButton(176, 350, 77, 37, "Locate", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "default-bold-small") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") GUIEditor.button[2] = guiCreateButton(263, 350, 77, 37, "Close", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[2], "default-bold-small") guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA") GUIEditor.gridlist[1] = guiCreateGridList(538, 274, 524, 309, false) guiGridListAddColumn(GUIEditor.gridlist[1], "Name", 0.2) guiGridListAddColumn(GUIEditor.gridlist[1], "X", 0.2) guiGridListAddColumn(GUIEditor.gridlist[1], "Y", 0.2) guiGridListAddColumn(GUIEditor.gridlist[1], "Z", 0.2)
FileEX Posted April 12, 2024 Posted April 12, 2024 I don't think you can disable the horizontal scrollbar. You can force it to show, but you can't hide it. The width of the gridlist columns cannot exceed 0.95, then the horizontal scrollbar will not appear.
Mischief-1 Posted April 12, 2024 Author Posted April 12, 2024 3 hours ago, FileEX said: I don't think you can disable the horizontal scrollbar. You can force it to show, but you can't hide it. The width of the gridlist columns cannot exceed 0.95, then the horizontal scrollbar will not appear. I see, thanks how do I make the gui that when i press the key again it closes? addEvent("playerOnClick", true) addEventHandler("playerOnClick", root, function() guiGridListClear ( w.gridList.main ) for i,veh in ipairs(getElementsByType("vehicle")) do if veh ~= vehicle then local row = guiGridListAddRow ( w.gridList.main ) local x,y,z = getElementPosition(veh) guiGridListSetItemText ( w.gridList.main, row, w.gridList.column1, getVehicleName ( veh ), false, false ) guiGridListSetItemText ( w.gridList.main, row, w.gridList.column2, x, false, false ) guiGridListSetItemText ( w.gridList.main, row, w.gridList.column3, y, false, false ) guiGridListSetItemText ( w.gridList.main, row, w.gridList.column4, z, false, false ) end end guiSetVisible(w.main, true) showCursor(true) end ) function hasPermission(key,keyState) if getElementData(localPlayer, "logedin") then triggerServerEvent("hasPermissionEvent",localPlayer,key,keyState) end end bindKey("p", "down", hasPermission) 10 minutes ago, Mischief-1 said: I see, thanks how do I make the gui that when i press the key again it closes? addEvent("playerOnClick", true) addEventHandler("playerOnClick", root, function() guiGridListClear ( w.gridList.main ) for i,veh in ipairs(getElementsByType("vehicle")) do if veh ~= vehicle then local row = guiGridListAddRow ( w.gridList.main ) local x,y,z = getElementPosition(veh) guiGridListSetItemText ( w.gridList.main, row, w.gridList.column1, getVehicleName ( veh ), false, false ) guiGridListSetItemText ( w.gridList.main, row, w.gridList.column2, x, false, false ) guiGridListSetItemText ( w.gridList.main, row, w.gridList.column3, y, false, false ) guiGridListSetItemText ( w.gridList.main, row, w.gridList.column4, z, false, false ) end end guiSetVisible(w.main, true) showCursor(true) end ) function hasPermission(key,keyState) if getElementData(localPlayer, "logedin") then triggerServerEvent("hasPermissionEvent",localPlayer,key,keyState) end end bindKey("p", "down", hasPermission) Edit : you can disregard these, I made if else statement and created to false. function playerOnClick(key,keyState) if (keyState == "down") then if (guiGetVisible(w.main) == false) then guiGridListClear ( w.gridList.main ) for i,veh in ipairs(getElementsByType("vehicle")) do if veh ~= vehicle then local row = guiGridListAddRow ( w.gridList.main ) local x,y,z = getElementPosition(veh) guiGridListSetItemText ( w.gridList.main, row, w.gridList.column1, getVehicleName ( veh ), false, false ) guiGridListSetItemText ( w.gridList.main, row, w.gridList.column2, x, false, false ) guiGridListSetItemText ( w.gridList.main, row, w.gridList.column3, y, false, false ) guiGridListSetItemText ( w.gridList.main, row, w.gridList.column4, z, false, false ) end end guiSetVisible(w.main, true) showCursor(true) else guiSetVisible(w.main, false) showCursor(false) end end end addEvent("playerOnClick",true) addEventHandler("playerOnClick",root,playerOnClick) but of course, If you can recommend a better way than what I did please feel free to share your opinion I would very much appreciate it. 1
Human Resources Staff Vinyard Posted April 14, 2024 Human Resources Staff Posted April 14, 2024 Closing this as solved.
Recommended Posts