.get_element_value with radio button sets
-
@sdmitch said:
Is there a way of giving the focus back to the model without having to click the wheel button?
No current cross-platform method in the API. It has been requested, along with onFocus & onBlur observer callbacks.
Normally you could call in JS,
%(#8000BF)[window.opener.focus()]
, but in the Microsoft WebBrowser Control interface, the%(#8000BF)[opener]
window object is not exposed (presumably for security reasons?)There is no API method that currently returns a handle to SketchUp's application window either, so you cannot have the html page tell the Ruby-side that the DOM loading is complete, and have the Ruby-side set focus back to the app. This has also been requested.
There are low-level solutions, on PC, using "Win32API.so", check the forum, ThomThom and I, and driven all discussed it. There's a topic labeled "Get Sketchup window handle" or similar.
-
Dan, Just as I expected but not a big deal.
Thanks.
-
Sam,
T think you may want window_blur http://sketchucation.com/forums/viewtopic.php?f=180&t=49075&p=441642&hilit=.window_blur#p441398
but maybe not...
john -
John, I tried the .show_modal and, just like the API said, nothing is allowed to happen as long as the WebDialog is displayed. I couldn't figure out how the hide it and then bring it back to make a change to the options selected.
-
sorry sam, I'm on a laptop without access to all my test snippets so I pointed that one...
the show_modal is for my mac, works with show on PC's
these test are probably what I should have pointed to
http://sketchucation.com/forums/viewtopic.php?f=180&t=49075&p=441642&hilit=.window_blur#p441326
you can call focus or blur whenever you want, the dialog dosn't need to be focused to use them...
1ohn -
@Sam:
(1) It would help if you put your OS, and SketchUp Free vs Pro, into your profile, so it appears at the left of your posts.
That way people would not purposely point you towards a method that was specific to an OS that your not developing on / for.
(2) Have another look at the example I wrote for you. It does exactly what you just described. (And uses a platform conditional statement to call the correct
show
method.)Keep in mind you need to hold the option refs as @vars on the Ruby side, and restore them to the dialog's controls after each show (because the HTML file is reloaded.)
Ie.. closing the dialog with
close()
does not destroy it. It is still a valid object, just as it was after you created it, but before it was shown for the first time. -
Hi!
In John/driven's example he uses dlg8.set_html(html) with a Ruby "inline" HTML codestring. That works on Mac? I thought set_html() was to be avoided?
So doing like that and putting in an image for button like below would work on Mac?
In Ruby..
my_icon=File.join(File.dirname(FILE), "folder/myicon_pic.png")( In the HTML wrapped something like html = %[html + js code etc...])
Have an image as a button:
<img src="#{my_icon}" width="24" height="24" onClick="jsfunction()">Note, Im not using a separate Html file in this case.
I think Adam is doing something similar in Goldilocks, but uses URL if I remember it correct.Hope I'm not hijacking the thread, thought it was relevant.
-
@jolran said:
Hope I'm not hijacking the thread, thought it was relevant.
Hi jolran,
I agree, however there's a specific thread I started on the subject http://sketchucation.com/forums/viewtopic.php?f=180&t=49338#p443472
try those test files on your mac... I have others as well, that work for me.
john -
@jolran said:
So doing like that and putting in an image for button like below would work on Mac?
It used to work, then it didn't. Then it might be working for some. But not me.
I wouldn't rely on it. -
Ahh, I see John. If I get it right the sethtml thing is working cause of updated Mountain Lion?
Thomthom, I have been searching through threads where you discuss just this issue, thats why I also asked this question. Being not confident in Webdialog, the platform issues are a bit confusing sometimes. But I take your word for it and try to fix it with set_file instead.
Thanks.
Advertisement