mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-02 14:38:50 +00:00
Merge pull request #48 from BerkieBb/main
feat(ox_lib/interface/menu): onClose keyPressed
This commit is contained in:
1 file changed
+9
-3
@@ -46,7 +46,7 @@ lib.registerMenu(data, cb)
|
|||||||
* Default: `false`
|
* Default: `false`
|
||||||
* canClose: `boolean`
|
* canClose: `boolean`
|
||||||
* If set to false the user won't be able to exit the menu without pressing one of the buttons.
|
* If set to false the user won't be able to exit the menu without pressing one of the buttons.
|
||||||
* onClose: `function`
|
* onClose: `function`(keyPressed?: `'Escape' | 'Backspace'`)
|
||||||
* Function that runs when the menu is exited via ESC/Backspace.
|
* Function that runs when the menu is exited via ESC/Backspace.
|
||||||
* onSelected: `function`(selected: `number`: scrollIndex: `number`: args: `any`)
|
* onSelected: `function`(selected: `number`: scrollIndex: `number`: args: `any`)
|
||||||
* Function being ran when the selected button in the menu changes.
|
* Function being ran when the selected button in the menu changes.
|
||||||
@@ -190,8 +190,11 @@ lib.registerMenu({
|
|||||||
onSelected = function(selected, scrollIndex, args)
|
onSelected = function(selected, scrollIndex, args)
|
||||||
print(selected, scrollIndex, args)
|
print(selected, scrollIndex, args)
|
||||||
end,
|
end,
|
||||||
onClose = function()
|
onClose = function(keyPressed)
|
||||||
print('Menu closed')
|
print('Menu closed')
|
||||||
|
if keyPressed then
|
||||||
|
print(('Pressed %s to close the menu'):format(keyPressed))
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
options = {
|
options = {
|
||||||
{label = 'Simple button', description = 'It has a description!'},
|
{label = 'Simple button', description = 'It has a description!'},
|
||||||
@@ -225,8 +228,11 @@ lib.registerMenu({
|
|||||||
onSelected: (selected, scrollIndex, args) => {
|
onSelected: (selected, scrollIndex, args) => {
|
||||||
console.log(selected, scrollIndex, args)
|
console.log(selected, scrollIndex, args)
|
||||||
},
|
},
|
||||||
onClose: () => {
|
onClose: (keyPressed) => {
|
||||||
console.log('Menu closed')
|
console.log('Menu closed')
|
||||||
|
if (keyPressed) {
|
||||||
|
console.log(`Pressed ${keyPressed} to close the menu`)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
{label: 'Simple button', description: 'It has a description!'},
|
{label: 'Simple button', description: 'It has a description!'},
|
||||||
|
|||||||
Reference in new issue
Block a user