Attaching notifiers to buttons in show_custom_prompt ?

It is possible to show custom views and attach notifiers to buttons (the ones you call with say vb:button{ “This is a placeholder!” }) in those views, but what about for the bottom buttons in a custom prompt created using renoise.app():show_custom_prompt? Suppose for example I call

renoise.app():show_custom_prompt(title, content_view, {"Button1", "Button2"})

How can I make it so button1 does something when I click on it and button2 does something (different) when I click on it?

Best,

Laser

function main()
  
  local vb = renoise.ViewBuilder()
  
  local my_view = vb:row {
    vb:text {
      text = "My content"
    }
  }
  
  local modal_popup = renoise.app():show_custom_prompt("My window", my_view, { "Abort", "OK" })

  -- script resumes here once a button is pressed
  if modal_popup == "Abort" then
    print("Abort button was pressed")
  elseif modal_popup == "OK" then
    print("OK button was pressed")
  else
    print("The window was closed")
  end
  
end 

main()

NB1. the close [x] button will return the text “Cancel”.

NB2. It’s a lot more common to use non modal dialogs (:show_custom_dialog). The modal dialog will steal all focus, which can be quite annoying imo.

Nice! Thank you for this help. I’ll reply again if I run into any further trouble on this topic.