bug: Menubar object issue with onSelect event #118

Open
opened 2024-08-06 11:36:42 +08:00 by C2Gamser · 0 comments
C2Gamser commented 2024-08-06 11:36:42 +08:00 (Migrated from github.com)

Describe the bug

The bug occurs when trying to use the 'onSelect' event to execute a function. When attempting to use onSelect(function goes here) in code, the function is not executed when the user selects an entry in the menubar.

To Reproduce
local basalt = require("basalt")

local main = basalt.createFrame()

local example_bar = main:addMenubar()
example_bar:setOptions({"Entry 1", "Entry 2", "Entry 3"})

example_bar:onSelect(function(self, event, item)
basalt.debug("Selected item: ", item.text)
end)

Then click on an entry in the program

Expected behavior

You expect to see the debug appear with the correct item (this works when you swap menuBar with list) however, it does not execute.

Screenshots
Here I have selected an entry with the code described above, and there is no debug that has run.
image

Additional context

I asked in the computer craft discord for help, someone said its probably a bug.

Checklist

[X] I am running the latest version.
Tick the box if you are running the latest version!

**Describe the bug** The bug occurs when trying to use the 'onSelect' event to execute a function. When attempting to use onSelect(*function goes here*) in code, the function is not executed when the user selects an entry in the menubar. **To Reproduce** local basalt = require("basalt") local main = basalt.createFrame() local example_bar = main:addMenubar() example_bar:setOptions({"Entry 1", "Entry 2", "Entry 3"}) example_bar:onSelect(function(self, event, item) basalt.debug("Selected item: ", item.text) end) *Then click on an entry in the program* **Expected behavior** You expect to see the debug appear with the correct item (this works when you swap menuBar with list) however, it does not execute. **Screenshots** Here I have selected an entry with the code described above, and there is no debug that has run. ![image](https://github.com/user-attachments/assets/f5828205-3288-48fe-b27a-9296f93767be) **Additional context** I asked in the computer craft discord for help, someone said its probably a bug. **Checklist** [X] I am running the latest version. Tick the box if you are running the latest version!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: GitHub/Basalt#118
No description provided.