From 42067e1791842116bf9c3f3f94309c6826cdd16c Mon Sep 17 00:00:00 2001 From: Alexei Anoshenko Date: Mon, 10 Aug 2026 16:00:40 +0300 Subject: [PATCH] Update popup.go --- popup.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/popup.go b/popup.go index 63eb874..d2c9112 100644 --- a/popup.go +++ b/popup.go @@ -294,6 +294,8 @@ type PopupButton struct { // OnClick is the handler function that gets called when the button is pressed OnClick func(Popup) + + Binding string } type popupButton struct { @@ -602,6 +604,29 @@ func (popup *popupData) Get(tag PropertyName) any { } } return nil + + case Buttons: + if value := popup.getRaw(DismissEvent); value != nil { + if buttons, ok := value.([]popupButton); ok { + result := make([]PopupButton, 0, len(buttons)) + for _, button := range buttons { + btn := PopupButton{ + Title: button.title, + Type: button.buttonType, + } + switch listener := button.onClick.rawListener().(type) { + case string: + btn.Binding = listener + + case func(Popup): + btn.OnClick = listener + } + result = append(result, btn) + } + return result + } + } + return nil } return popup.getRaw(tag)