Jump to content

gridlist onguiclick


robod

Recommended Posts

Hello, I have this code:

function click ( button, state, sx, sy, x, y, z, elem, gui )

	local teamName
	local menu
		teamName = "spies"
		menu = spiesMenu

	primarySelection = getSelectedWeapon ( teamName, "primary" )
	secondarySelection = getSelectedWeapon ( teamName, "secondary" )
	throwableSelection = getSelectedWeapon ( teamName, "throwable" )
	specialSection = getSelectedWeapon ( teamName, "special" )
		
	if primarySelection then
		outputChatBox ( primarySelection )
	end
	if secondarySelection then
		outputChatBox ( secondarySelection )
	end
        
end

function getSelectedWeapon ( teamName, category )
	if teamName ~= "mercenaries" and teamName ~= "spies" then return false end
	if retrieveGridList[teamName][category] == nil then return false end
	local gridList = retrieveGridList[teamName][category]
	local row = guiGridListGetSelectedItem ( gridList )
	if row == -1 then return false end
	selectedWeapon = guiGridListGetItemText ( gridList, row, 1 )
	return selectedWeapon
end

 

and I have 4 gridlists in one GUI. How can I output just one selected item from one gridlist item I select? Now it outputs every item selected from each gridlist. 

Link to comment

Is the function "click" attached to the "onClientClick" event? Try debugging the code using outputChatBox and see what each value shows.

It's hard to figure out what's wrong just by looking at that piece of code. It would be better if you posted all code of the gridList.

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