[Bug]: [OSX, standalone] It is not possible to edit a TextEditor shown inside a PopupMenu::CustomComponent
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Reproduce the provided example in a Projucer GUI template on macOS as a standalone app with JUCE 8.0.12. Start by examining how PopupMenu::CustomComponent and TextEditor handle keyboard input, comparing the standalone behavior with the working plugin and other platforms. Done means the TextEditor inside the popup accepts keyboard input and its value can be edited.
Written by the indexing model from the issue text.
Description
Detailed steps on how to reproduce the bug
When compiled as a standalone app on OSX with juce 8.0.12, TextEditor set inside a PopupMenu::CustomComponent are not editable. On linux and windows and even on OSX as a plugin it works but standalone its impossible to edit the text.
By using a subclass of TextEditor and some other code to make sure that the PopupMenu doesn't close too fast, I'm able to see that clicks are registered, the location of the caret changes but keyPressed is never called. onReturnKey is never called either.
Here is some code to reproduce the issue. I have reproduced it with a projucer GUI template and the following code:
Custom popupmenu h file:
#pragma once
#include <JuceHeader.h>
class PopupTextEditor
: public juce::PopupMenu::CustomComponent
{
public:
void getIdealSize(int & idealWidth, int & idealHeight) override;
void initPopupTextEditor(std::unique_ptr<juce::TextEditor> textEditor);
private:
std::unique_ptr<juce::TextEditor> mPopupTextEditor;
JUCE_LEAK_DETECTOR(PopupTextEditor)
};
custom popupmenu cpp file:
#include "cg_PopupTextEditor.h"
//==============================================================================
void PopupTextEditor::getIdealSize(int & idealWidth, int & idealHeight)
{
idealWidth = mPopupTextEditor->getWidth();
idealHeight = mPopupTextEditor->getHeight();
}
//==============================================================================
void PopupTextEditor::initPopupTextEditor(std::unique_ptr<juce::TextEditor> textEditor)
{
mPopupTextEditor = std::move(textEditor);
addAndMakeVisible(*mPopupTextEditor);
}
main component h file
#pragma once
#include <JuceHeader.h>
#include <memory>
class MainComponent : public juce::Component
{
public:
//==============================================================================
MainComponent();
~MainComponent() override;
//==============================================================================
void paint (juce::Graphics&) override;
void resized() override;
juce::PopupMenu pop;
private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainComponent)
};
main component cpp file
#include "MainComponent.h"
#include "cg_PopupTextEditor.h"
//==============================================================================
MainComponent::MainComponent()
{
setSize (600, 400);
auto edit = std::make_unique<juce::TextEditor>("text editor");
edit->setSize(60, 20);
edit->setText("3434");
edit->selectAll();
auto popup{std::make_unique<PopupTextEditor>()};
popup->initPopupTextEditor(std::move(edit));
pop.clear();
pop.addCustomItem(1, std::move(popup), nullptr, "text editor");
pop.showMenuAsync(juce::PopupMenu::Options(), [](int res){});
}
MainComponent::~MainComponent()
{
}
//==============================================================================
void MainComponent::paint (juce::Graphics& g)
{
}
void MainComponent::resized()
{
}
What is the expected behaviour?
The value of the texteditor should be editable with the keyboard
Operating systems
macOS
What versions of the operating systems?
Tahoe 26.2
Architectures
Arm64/aarch64
Stacktrace
Plug-in formats (if applicable)
Standalone
Plug-in host applications (DAWs) (if applicable)
No response
Testing on the develop branch
I have not tested against the develop branch
Code of Conduct
- I agree to follow the Code of Conduct
- Dominant language
- C++
- Stars
- 8.9k
- Forks
- 2.2k
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from juce-framework/JUCE
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
juce-framework/JUCE#1765 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
juce-framework/JUCE#1764 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
juce-framework/JUCE#1762 ·
Maintainers usually reply within 2 days
-
Linux: WebBrowserComponent shows nothing unless the GTK and WebKit development packages are installedPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
juce-framework/JUCE#1730 ·
Maintainers usually reply within 2 days
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
juce-framework/JUCE#1687 · 1 comment ·
Maintainers usually reply within 2 days
All issues in juce-framework/JUCE
Similar issues
-
Component: Python API
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Vector35/binaryninja-api#8649 ·
Maintainers usually reply within 3 days
-
ai_p2 comp-parquet-reader-v3
Difficulty 2/5 Half a day Newbie friendliness 66/100
ClickHouse/ClickHouse#124986 ·
Maintainers usually reply within 1 day
-
bug product: very_good_flutter_plugin
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
VeryGoodOpenSource/very_good_templates#654 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
AcademySoftwareFoundation/OpenImageIO#5550 ·
Maintainers usually reply within 2 days