Skip to content

Commit

Permalink
Fix DirectoryPathComponent not updating when value changes
Browse files Browse the repository at this point in the history
  • Loading branch information
timothyschoen committed Feb 19, 2025
1 parent 698270f commit 2c49ec4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Source/Components/PropertiesPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ class PropertiesPanel : public Component {
}
};

struct DirectoryPathComponent final : public PropertiesPanelProperty {
struct DirectoryPathComponent final : public PropertiesPanelProperty, public Value::Listener {
String label;
SmallIconButton browseButton = SmallIconButton(Icons::Folder);
Value property;
Expand All @@ -1135,6 +1135,7 @@ class PropertiesPanel : public Component {
{
setPath(value.toString());
addAndMakeVisible(browseButton);
property.addListener(this);

browseButton.onClick = [this] {
Dialogs::showOpenDialog([this](URL const& url) {
Expand All @@ -1147,6 +1148,12 @@ class PropertiesPanel : public Component {
};
}

void valueChanged(Value& v) override
{
label = v.toString();
repaint();
}

void setPath(String path)
{
property = path;
Expand Down

0 comments on commit 2c49ec4

Please sign in to comment.