UI.inputbox with Webdialog


I found the UI.inputbox too limiting so I’ve decided to implement a web dialog with some html drop downs for selecting certain options. The problem I am having is that I have an inputbox that appears directly after the web dialog in the flow of my code. Somehow I need to pause the program flow until I get the correct response back from the web dialog and then proceed to the next step which is the input box.

I was thinking of using a while statement but this seems a little clunky to me. Just wondering what the pros would use in this type of situation.

I agree multiple inputs popping up one after the other is probably not the slickest user interface but that is what I have for now. At some point I will probably replace all the inputbox entries with web dialogs but for now I’m going to try to make them work together.


Using the modal method would seem to be the solution (WebDialog.show_modal) but this would be a problem for Mac users since it is not truly modal.


This should be easy to do (edit: no experience with Mac though):

in your html code add some sort of submit button that activates a javascript function that sends a message to your rubyscript to start an action where you open the UI.inputbox

In your ruby where you define the webdialog:

@wd.add_action_callback( "js2ruby" ) do |dlg, command|
  action = command.split(',')
  case action[0]
    when 'start_ui_inputbox'
      ...here your code for opening the UI.inputbox

and in your html/javascript something like:

function open_ui(){
  location = 'skp:js2ruby@start_ui_inputbox';