Has there been any movement on this? Would love to use it in SU2020.
Posts made by Sisu
-
RE: MS Physics and SU 2019
-
RE: How can a dialog be made modal on Mac
Thanks guys, I sure between your 2 solutions and with bit of re-architecture, I'll be able to port to the Mac.
Thom - I made some wrong assumptions about your code. I'd like to see a simple example.
John/driven - fauxModal is very cool. Nice approach with the HTML, I never considered building it 'on the fly'.
- JJ
-
RE: How can a dialog be made modal on Mac
Please remove the "[color=...]" and "[/color]" from the code before trying - I've not used BBCode much and tried to get too fancy.
-
RE: How can a dialog be made modal on Mac
Thom,
I can only get so far with your window class, I must be doing something wrong. On Windows I can make a modal window appear, but can't get my html/js loaded in it. On OS X, nothing seems to happen. Below is an example that is very simple: A window with an OK button. It works fine with the UI::WebDialog in doMsgBox, but I fail to get it to work in doTTMsgBox. I have tried many things from windows.rb and webdialog_patch.rb but to no success. What am I missing?
simple html/js:
<span class="syntaxhtml"><span class="syntaxdefault"><br /></span><span class="syntaxkeyword"><</span><span class="syntaxdefault">script language</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"javascript"</span><span class="syntaxkeyword">><br />function </span><span class="syntaxdefault">sendUserChoice</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">userInput</span><span class="syntaxkeyword">){ <br /> </span><span class="syntaxdefault">window</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">location</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">href </span><span class="syntaxkeyword">= </span><span class="syntaxstring">'skp;LTE_okBox@' </span><span class="syntaxkeyword">+ </span><span class="syntaxdefault">userInput</span><span class="syntaxkeyword">;<br />}<br /></span><span class="syntaxdefault"></script></span> <br /><body><br /> <input type="button" value="Ok" onClick='sendUserChoice("OK")'/><br /></body></span>
<span class="syntaxdefault"><br />Sketchup</span><span class="syntaxkeyword">;;require </span><span class="syntaxstring">'TT_Lib2/core.rb'<br /></span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">;;require </span><span class="syntaxstring">'TT_Lib2/webdialog_patch.rb'<br /></span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">;;require </span><span class="syntaxstring">'TT_Lib2/gui.rb'<br /></span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">;;require </span><span class="syntaxstring">'TT_Lib2/window'<br /></span><span class="syntaxdefault">file_loaded</span><span class="syntaxkeyword">?(</span><span class="syntaxstring">"TT_demo"</span><span class="syntaxkeyword">)<br /><br /><br /></span><span class="syntaxdefault">$_MSBReply </span><span class="syntaxkeyword">= </span><span class="syntaxstring">"0"<br /></span><span class="syntaxdefault">module MYMB<br />def MYMB</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">doMsgBox</span><span class="syntaxkeyword">()<br /> </span><span class="syntaxdefault">mbDlg </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">UI</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">WebDialog</span><span class="syntaxkeyword">.new(</span><span class="syntaxstring">"LTE_okbox"</span><span class="syntaxkeyword">, </span><span class="syntaxdefault">false</span><span class="syntaxkeyword">, </span><span class="syntaxstring">"LTE"</span><span class="syntaxkeyword">, </span><span class="syntaxdefault">0</span><span class="syntaxkeyword">, </span><span class="syntaxdefault">0</span><span class="syntaxkeyword">, </span><span class="syntaxdefault">0</span><span class="syntaxkeyword">, </span><span class="syntaxdefault">0</span><span class="syntaxkeyword">, </span><span class="syntaxdefault">true</span><span class="syntaxkeyword">)<br /> </span><span class="syntaxdefault">mbDlg</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">add_action_callback</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"LTE_okBox"</span><span class="syntaxkeyword">) do |</span><span class="syntaxdefault">web_dialog</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">user_action</span><span class="syntaxkeyword">|<br /> </span><span class="syntaxdefault">puts </span><span class="syntaxstring">"user_action = " </span><span class="syntaxkeyword">+ </span><span class="syntaxdefault">user_action</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">to_s<br /> </span><span class="syntaxkeyword">if </span><span class="syntaxdefault">user_action</span><span class="syntaxkeyword">.include? </span><span class="syntaxstring">"OK" <br /> </span><span class="syntaxdefault">$_MSBReply </span><span class="syntaxkeyword">= </span><span class="syntaxstring">"1"<br /> </span><span class="syntaxdefault">mbDlg</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">close <br /> end<br /> end<br /> mbDlg</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">set_file</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">find_support_file</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"Plugins/jj/okbox.html"</span><span class="syntaxkeyword">))<br /> </span><span class="syntaxdefault">mbDlg</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">show_modal</span><span class="syntaxkeyword">() <br /> </span><span class="syntaxdefault">mbDlg</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">bring_to_front<br />end </span><span class="syntaxcomment">#dMB<br /><br /></span><span class="syntaxdefault">def MYMB</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">doTTMsgBox</span><span class="syntaxkeyword">()<br /> </span><span class="syntaxdefault">mbDlg </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">TT</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">GUI</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Window</span><span class="syntaxkeyword">.new(</span><span class="syntaxstring">"LTE_okbox"</span><span class="syntaxkeyword">, </span><span class="syntaxdefault">false</span><span class="syntaxkeyword">, </span><span class="syntaxstring">"LTE"</span><span class="syntaxkeyword">, </span><span class="syntaxdefault">10</span><span class="syntaxkeyword">, </span><span class="syntaxdefault">10</span><span class="syntaxkeyword">, </span><span class="syntaxdefault">220</span><span class="syntaxkeyword">, </span><span class="syntaxdefault">220</span><span class="syntaxkeyword">, </span><span class="syntaxdefault">true</span><span class="syntaxkeyword">)<br /> </span><span class="syntaxdefault">mbDlg</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">add_action_callback</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"LTE_okBox"</span><span class="syntaxkeyword">) do |</span><span class="syntaxdefault">web_dialog</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">user_action</span><span class="syntaxkeyword">|<br /> </span><span class="syntaxdefault">puts </span><span class="syntaxstring">"user_action = " </span><span class="syntaxkeyword">+ </span><span class="syntaxdefault">user_action</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">to_s<br /> </span><span class="syntaxkeyword">if </span><span class="syntaxdefault">user_action</span><span class="syntaxkeyword">.include? </span><span class="syntaxstring">"OK" <br /> </span><span class="syntaxdefault">$_MSBReply </span><span class="syntaxkeyword">= </span><span class="syntaxstring">"TT1"<br /> </span><span class="syntaxdefault">mbDlg</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">close <br /> end<br /> end<br /> p2 </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">find_support_file</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"Plugins/jj/okbox.html"</span><span class="syntaxkeyword">)<br /> </span><span class="syntaxcomment">#mbDlg.set_file(p2)<br /> </span><span class="syntaxdefault">mbDlg</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">set_html</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">p2</span><span class="syntaxkeyword">)<br /> </span><span class="syntaxdefault">mbDlg</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">show_window</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">true</span><span class="syntaxkeyword">) <br /> </span><span class="syntaxdefault">mbDlg</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">bring_to_front <br />end </span><span class="syntaxcomment">#dTTMB<br /></span><span class="syntaxdefault">end </span><span class="syntaxcomment">#m MYMB<br /><br /></span><span class="syntaxdefault">MYMB</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">doMsgBox<br />puts </span><span class="syntaxstring">"back from SU; " </span><span class="syntaxkeyword">+ </span><span class="syntaxdefault">$_MSBReply<br />MYMB</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">doTTMsgBox<br />puts </span><span class="syntaxstring">"back from TT; " </span><span class="syntaxkeyword">+ </span><span class="syntaxdefault">$_MSBReply</span>
Thanks for taking the time to look into this - JJ
-
RE: How can a dialog be made modal on Mac
Thanks for the all the replies. They have been very helpful. I have downloaded Thom's code and am working with it now.
I looked at John's fauxModal, but I had a hard time understanding the code.
John you said you would "PM you my code if you want a look, but you need to test it on a mac," I would like to look at it, think I can learn a lot from it. I do have a Mac - OS X 10.6.8, although I am far more familiar with Windows.TIG, It's easier to think of my code not as a tool but as an application that uses SU as a graphics display engine, taking advantage of the SU classes and methods. The user communicates to the app by a series of dialog windows, modal and non-modal. With the dialogs the user to puts together combinations of parts. There are rules about how the parts can connect and the parts being connected must be compatible. All of which means that reducing assembly errors is a big part of the application. One example of the need for modal windows is when the user asks for an illegal combination, I need them to remain on the dialog window until they acknowledge the change I made for them or select a different option. There are other examples, but no need to cover them in this thread.
Many thanks - Sisu / JJ
-
RE: How can a dialog be made modal on Mac
Thanks for the reply John, I was afraid that would be the answer. In my case password validation is done in the plugin and it is not meant to be absolute security. I have other windows that gather a lot of information about what the user wants to do next, and that information must be gathered before the user can progress. As you point out some of the UI method's are modal so it is possible to do this on the Mac just not with SU/ruby. I hope this will addressed in future releases of SU as I find it difficult to imagine developing a sophisticated user-driven application without being able to control the user's navigation.
-
How can a dialog be made modal on Mac
I wish to have a modal password window, one that solicits a password, returns the user's input. The plugin then validates the password entered and until a valid password in entered nothing else can happen.
Under windows this this can done via dialog.show_modal.
But after playing around with Threads, join etc. I have yet to come up with a good method for doing this using dialog.show.Does anyone have ideas, suggestions or a simple sample they would share.
- JJ