@thomthom : But features/behaviour in UI.inputbox that was useful and not buggy can of course be adopted here.
Yes, the native UI.inputbox has the ability to pass 1 prompt array argument without a window title.
But it stupidly will not allow 2 args with the 2nd being the window title. (It raises an exception.)
Your code mimicked this. So I reordered the statements in the ArgumentParser to allow anywhere from 1..4 args.
A consumer can now do ...
HtmlUI::inpubox(["Name"], "Who are you?")
It is silly to force coders to stuff empty literal arrays into a method call, ie ...
HtmlUI::inpubox(["Name"], [], "Who are you?")
If there are no defaults, there is no good reason to force the passing of an empty array.
(This is forced inclusion of empty array arguments is a native UI::inputbox quirk.)
In testing this I also found that the argument parser sets the window :title to an empty string to mimic the native UI::inputbox which will display without a window caption. (Ie, the compatibility shim method does not allow the default Sketchup::app_name to be the default window caption.)
But this doesn't work with a Chromium window. If the window title is not set or is an empty string, then the window caption gets set to "inputbox.html".
The solution is to insert a space into an empty :title string if it is left empty (ie, not specified in the compatibility shim arguments.)
Yes, the native
UI.inputboxhas the ability to pass 1 prompt array argument without a window title.But it stupidly will not allow 2 args with the 2nd being the window title. (It raises an exception.)
Your code mimicked this. So I reordered the statements in the
ArgumentParserto allow anywhere from 1..4 args.A consumer can now do ...
It is silly to force coders to stuff empty literal arrays into a method call, ie ...
If there are no defaults, there is no good reason to force the passing of an empty array.
(This is forced inclusion of empty array arguments is a native
UI::inputboxquirk.)In testing this I also found that the argument parser sets the window
:titleto an empty string to mimic the nativeUI::inputboxwhich will display without a window caption. (Ie, the compatibility shim method does not allow the defaultSketchup::app_nameto be the default window caption.)But this doesn't work with a Chromium window. If the window title is not set or is an empty string, then the window caption gets set to
"inputbox.html".The solution is to insert a space into an empty
:titlestring if it is left empty (ie, not specified in the compatibility shim arguments.)