'LinKin Posted February 28, 2014 Share Posted February 28, 2014 Hello, I'm wondering if when we use guiComboBoxSetSelected() the event onClientGUIComboBoxAccepted is triggered. If not, how can we force it? Link to comment
Castillo Posted February 28, 2014 Share Posted February 28, 2014 Have you tried if it does or not? Link to comment
'LinKin Posted February 28, 2014 Author Share Posted February 28, 2014 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 Link to comment
Moderators Citizen Posted February 28, 2014 Moderators Share Posted February 28, 2014 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
'LinKin Posted February 28, 2014 Author Share Posted February 28, 2014 Thanks, I made it like I was trying to do it at the beginning I trigger the event and send it 1 more argument, triggerEvent("onClientGUIComboBoxAccepted", myCombobox, myCombobox, item) And well I just do the code inside the implementation of that event. 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