sketchucation logo sketchucation
    • 登入
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update

    .get_element_value with radio button sets

    已排程 已置頂 已鎖定 已移動 Developers' Forum
    22 貼文 6 Posters 1.1k 瀏覽 6 Watching
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • Dan RathbunD 離線
      Dan Rathbun
      最後由 編輯

      @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.

      I'm not here much anymore.

      1 條回覆 最後回覆 回覆 引用 0
      • sdmitchS 離線
        sdmitch
        最後由 編輯

        Dan, Just as I expected but not a big deal.

        Thanks.

        Nothing is worthless, it can always be used as a bad example.

        http://sdmitch.blogspot.com/

        1 條回覆 最後回覆 回覆 引用 0
        • D 離線
          driven
          最後由 編輯

          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

          learn from the mistakes of others, you may not live long enough to make them all yourself...

          1 條回覆 最後回覆 回覆 引用 0
          • sdmitchS 離線
            sdmitch
            最後由 編輯

            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.

            Nothing is worthless, it can always be used as a bad example.

            http://sdmitch.blogspot.com/

            1 條回覆 最後回覆 回覆 引用 0
            • D 離線
              driven
              最後由 編輯

              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

              learn from the mistakes of others, you may not live long enough to make them all yourself...

              1 條回覆 最後回覆 回覆 引用 0
              • Dan RathbunD 離線
                Dan Rathbun
                最後由 編輯

                @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.

                I'm not here much anymore.

                1 條回覆 最後回覆 回覆 引用 0
                • jolranJ 離線
                  jolran
                  最後由 編輯

                  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.

                  1 條回覆 最後回覆 回覆 引用 0
                  • D 離線
                    driven
                    最後由 編輯

                    @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

                    learn from the mistakes of others, you may not live long enough to make them all yourself...

                    1 條回覆 最後回覆 回覆 引用 0
                    • thomthomT 離線
                      thomthom
                      最後由 編輯

                      @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.

                      Thomas Thomassen — SketchUp Monkey & Coding addict
                      List of my plugins and link to the CookieWare fund

                      1 條回覆 最後回覆 回覆 引用 0
                      • jolranJ 離線
                        jolran
                        最後由 編輯

                        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.

                        1 條回覆 最後回覆 回覆 引用 0
                        • 1
                        • 2
                        • 2 / 2
                        • 第一個貼文
                          最後的貼文
                        Buy SketchPlus
                        Buy SUbD
                        Buy WrapR
                        Buy eBook
                        Buy Modelur
                        Buy Vertex Tools
                        Buy SketchCuisine
                        Buy FormFonts

                        Advertisement