Jump to content

guiComboBoxSetSelected triggers onClientGUIComboBoxAccepted?


'LinKin

Recommended Posts

  • Moderators
No,

I'm trying to use

triggerEvent("onClientGUIComboBoxAccepted", combobox_selectplayer, playerCount) ; where playerCount is an int

EDIT: No, the event onClientGUIComboBoxAccepted is not triggered after using guiComboBoxSetSelected

You right, the event isn't triggered (just check the sources).

You can't trigger buit-in events but you can just override the guiComboBoxSetSelected function to trigger a new custom event each time you do use this function:

--Copying the original function into _guiComboBoxSetSelected 
_guiComboBoxSetSelected = guiComboBoxSetSelected 
  
--Creating our custom event: 
addEvent("onClientGUIComboBoxSelected") 
  
--overriding the original one 
function guiComboBoxSetSelected( comboBox, itemIndex ) 
    --trigger our custom event: 
    triggerEvent("onClientGUIComboBoxSelected", comboBox, comboBox) 
  
    --call the original function with the same arguments: 
    return _guiComboBoxSetSelected( comboBox, itemIndex ) 
end 
  
--Add this if you want to be triggered when the user select it too: 
addEventHandler("onClientGUIComboBoxAccepted", root, function ( comboBox ) 
    triggerEvent("onClientGUIComboBoxSelected", comboBox, comboBox) 
end) 

And use that event instead of onClientGUIComboBoxAccepted:

function onComboSelected() 
    outputChatBox("comboBox selected") 
end 
addEventHandler("onClientGUIComboBoxSelected", root, onComboSelected) 

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