So far i have been using inputboxes to pass values from the user to the script. but with the limits of the inputbox,I have decided to move to using the WebDialog.
not to embed a webpage. but to make more user friendly, organized dialogs to pass values.
However i do not know how to handle the values passed in the html form. do i need to learn javascript?
or can ruby handle it all? if so how? any help getting pointed in the right direction is appreciated Thanks
You should not use the “skp:” protocol as it is still shown in the API documentation. It is limited, low-level and leads (especially newbies) to bad and hardly maintainable code. It’s not forbidden, but really, don’t use it, save your efforts and time and use an existing library that wraps a more comfortable function around it.
If you still haven’t started with WebDialogs, you are in a perfect position not to start with “skp:” at all.
If you have no experiences with JavaScript and just want a simple, but native/good looking UI that is better than inputbox, then the ideal solution is for example the SKUI (SketchUp UI) library. Download it, embed it into your project and you can generate WebDialogs purely with Ruby.
The skp: protocol should at least be wrapped in a function (to which you pass the callback name and parameters as arguments), which will already (slightly) decouple your code from the implementation that is inside the function, and improve your plugin’s design.
There have been numerous efforts to create solution to wrap the skp: into a library (can be found in many plugins), similar to what SKUI does. At the moment there is not (yet) a reusable stand-alone solution.