Keep WebDialog in front on XP/Vista?
-
Very simple question: does anyone know how to keep a WebDialog in front of the other Sketchup windows on XP/Vista? I know this can be accomplished in OSX using WebDialog.show_modal, but I'm not aware of a good way to accomplish this on other platforms.
Any help would be much appreciated.
Josh
-
dlg.show_modal{code_block}
should work on PC -
@jeemang said:
Very simple question: does anyone know how to keep a WebDialog in front of the other Sketchup windows on XP/Vista? I know this can be accomplished in OSX using WebDialog.show_modal, but I'm not aware of a good way to accomplish this on other platforms.
Any help would be much appreciated.
Josh
Just using
.show
should work. Under windows WebDialogs are always on top of it's owner Sketchup window..show_modal
is really for making modal windows, but under osx it doesn't work properly. But OSX has the quirk that WebDialogs doesn't normally stay on top if you use.show
- but it will stay on top when you use.show_modal
. -
On a PC
dlg.show{}
anddlg.show_modal{}
will both produce a dialog in front of the Sketchup window... BUT on a PC the 'show' version although it stays 'on top' it lets you deactivate and/or minimize it and activate the SKP window and work on that instead; whereas the 'modal' version demands that you enter data and OK/Close before returning to the SKP window as it becomes the active front window that cannot be deactivated, but only closed. -
Given your WebDialog instance var as
dlg
one-liner:
<span class="syntaxdefault">RUBY_PLATFORM</span><span class="syntaxkeyword">.include?(</span><span class="syntaxstring">'darwin'</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">?</span><span class="syntaxdefault"> dlg</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">show_modal</span><span class="syntaxkeyword">()</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">;</span><span class="syntaxdefault"> dlg</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">show</span><span class="syntaxkeyword">()</span><span class="syntaxdefault"> </span>
-
In my tools, I use this:
if !@wd.visible? # get the dialog back @wd.show() else @wd.bring_to_front() end
-
morning,
I'm just wondering, can you have a conditional .show{} in your loader tool button, so that the first time you click, it creates the WD but subsequent clicks will just bring it forward i.e. show_modal..
occasionally, I end up with 5 or 6 copies of the same WD under my drawing...
and if you can do that, could you use it with a modify key to switch between show or show_modal... rather than closing something thats in the way, eg. WedConsole
maybe with a conditional tooltip...
probably only useful on a mac....
ADD: or maybe a version of Todd's would work?
john
-
@unknownuser said:
In my tools, I use this:
I use something similar:
<span class="syntaxdefault">def self</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">show_window</span><span class="syntaxkeyword">(</span><span class="syntaxdefault"> window </span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> if window</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">visible<br /> window</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">bring_to_front<br /> else<br /> if RUBY_PLATFORM</span><span class="syntaxkeyword">.include?(</span><span class="syntaxstring">'darwin'</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> window</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">show_modal </span><span class="syntaxcomment"># To keep window on top of SU on OSX<br /></span><span class="syntaxdefault"> else<br /> window</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">show<br /> end<br /> end<br />end </span><span class="syntaxcomment"># def </span><span class="syntaxdefault"></span>
-
I'm using a wrapper over WebDialog - subclassed it. http://www.thomthom.net/software/sketchup/tt_lib2/doc/TT/GUI/Window.html
-
Wowsers, thanks for all the responses. Question answered!
Advertisement