Enhanced Menu Control and Bug Fixes
This release adds more flexibility in menu positioning behavior and resolves naming conflicts with JUCE internals.
✨ New Features
Enhanced showPopupMenu() Control
- New Parameter:
centerOnCheckedItem(4th parameter)- When
true: Centers the menu on any checked item at the cursor position - When
false: Shows menu at cursor without repositioning (default behavior) - Perfect for preset browsers where you want the current selection centered at the cursor
- When
Example:
juce::PopupMenu menu;
for (int i = 1; i <= 128; ++i)
{
bool isCurrent = (i == currentPreset);
menu.addItem(i, "Preset " + juce::String(i), true, isCurrent);
}
// Center the checked item at cursor position
int result = juce::NativeMacPopupMenu::showPopupMenu(menu, nullptr, false, true);🐛 Bug Fixes
Fixed JUCE Naming Conflicts
- Renamed:
MenuItemTarget→NativeMacMenuItemTarget - Reason: Prevents conflicts with JUCE's internal
MenuItemTargetclass - Impact: Resolves compilation errors in projects using JUCE's menu internals
📚 Documentation
- Updated README with clearer installation instructions
- Enhanced API documentation for the new
centerOnCheckedItemparameter - Added comparison table showing when to use each menu function
- Added MIT LICENSE file
📦 Installation
git submodule add https://github.com/reales/juce_native_macos_dialogs.git Modules/juce_native_macos_dialogs
git submodule update --init --recursive
cd Modules/juce_native_macos_dialogs
git checkout v2.1.0🎯 Menu Function Comparison
| Function | Use Case | Auto-Scroll/Center | Example |
|---|---|---|---|
showPopupMenu() |
Context menus, right-click | Optional (via parameter) | Right-click menu |
showPopupMenu(..., true) |
Preset browser at cursor | Yes (centers on checked) | 128 presets, center #64 |
showPopupMenuAt() |
Preset browsers at position | Yes (auto-scroll) | Below button, scroll to #64 |
showPopupMenuAtFixed() |
ComboBox dropdowns | No (exact position) | Voice count: 1/2/4/6/8 |
📖 Full Documentation
See the README for complete API reference and examples.
Previous Releases
v2.0.0
- Native popup menu support (NativeMacPopupMenu)
- Three menu display modes
- Auto-scroll to checked items
- 16 comprehensive examples
v1.0.0
- Native dialog boxes (text input, info, confirm)
- Custom clipboard support with UTI types
- Plugin-friendly focus restoration