sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    (Webdialog) Window match clientsize.

    Scheduled Pinned Locked Moved Developers' Forum
    19 Posts 5 Posters 418 Views 5 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • jolranJ Offline
      jolran
      last edited by

      @unknownuser said:

      I use callbacks when I want to ensure a given client size. I've not found any other method as the window frame differ from OS to OS - even from window theme to window theme

      I see. That make sence.

      As I said, my code snippets was more of a question than a revelation.

      @unknownuser said:

      doc_width = size[0].to_f
      w_factor = doc_width/300 # Gives me 5.6
      wd_width = doc_width/w_factor
      This gives for me 300 again.

      But it should? I hope I havent done any wierd backward-logic again..
      The main Idea was that the dialog should have the same size-proportional regardless of screen resolution.

      Aerilius. I will have a deep look at your code and come back later.
      Have some other boring stuff to take care of first.

      Thank you for your answer and code.

      1 Reply Last reply Reply Quote 0
      • jolranJ Offline
        jolran
        last edited by

        Finally had the time to go through your explaination, Aerilius.
        And I now understand what you are doing in your code.

        That make perfect sence, I got it all backwards.

        Somehow I got the impression one had to resize dialog window to compensate for different user monitor sizes.
        Thats why I was fiddeling with screen size. πŸ‘Š
        And as Dan was pointing out, this can easyly become problematic.

        I think dlg.set_size will do fine for me. Thanks πŸ‘

        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          It feels SO good to have an epiphany !

          πŸ˜„

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • jolranJ Offline
            jolran
            last edited by

            β˜€ Epiphany

            1 Reply Last reply Reply Quote 0
            • thomthomT Offline
              thomthom
              last edited by

              @jolran said:

              :enlight: Epiphany

              Sounds like the name of a girl...

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

              1 Reply Last reply Reply Quote 0
              • jolranJ Offline
                jolran
                last edited by

                @unknownuser said:

                Sounds like the name of a girl...

                Yeah, Tiffany.

                On the subject about resizing webdialogs. I have been experimenting with dlg.set_size a little today. And it's possible to change layout with the click on a button, for ex. With some callbacks and CSS. Cool! One can therefore have vertical or horisontalmenys as an option.

                Now since I'm on a roll with strange solutions and odd logic, I gotta ask. Is there any pitfall doing this?

                I reckon 1 is that the dialog dimensions will only be remembered during sessions(if using @variables), and go back to default setting when restarting Sketchup.

                I'm just experimenting so it's not sure I would need a function like this, but it would be nice to know if its safe to use.

                1 Reply Last reply Reply Quote 0
                • D Offline
                  driven
                  last edited by

                  @jolran said:

                  I reckon 1 is that the dialog dimensions will only be remembered during sessions(if using @variables), and go back to default setting when restarting Sketchup.

                  don't forget it's not the WWW and a independent browser.
                  SU can collect values and rewrite the html and can use .min_height, .max_height etc. to lock and carry the setting to the next session...

                  overall position is harder to guarantee.
                  john

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

                  1 Reply Last reply Reply Quote 0
                  • jolranJ Offline
                    jolran
                    last edited by

                    @unknownuser said:

                    don't forget it's not the WWW and a independent browser.
                    SU can collect values and rewrite the html and can use .min_height, .max_height etc. to lock and carry the setting to the next session...

                    Yeah, Trying to get a grasp of that. It's not evident (for me anyway) what one "should do" in ruby and what goes best in html/JS.

                    Storing setting to the next session on the Ruby side, must not attributes be good choice then?

                    @unknownuser said:

                    overall position is harder to guarantee.

                    You mean :left => 600, :top => 200 ?

                    Why would that be more difficult to store?

                    Thanks.

                    1 Reply Last reply Reply Quote 0
                    • A Offline
                      Aerilius
                      last edited by

                      Although it is possible we should be careful not to fiddle too much with window management without a good reason. Dialogs in SketchUp store their size and position automatically.

                      If a dialog needs to have a specific size set to work correctly (because of dynamic content etc.) then we can do this. There is even less often a reason to force a specific position on the screen (other than the position from the last session, which the dialog should remember on its own). Window positioning is user land and should be left to be intelligently managed by the window manager (placing windows on free screen area, considering screen size and workspaces etc.).

                      1 Reply Last reply Reply Quote 0
                      • D Offline
                        driven
                        last edited by

                        @aerilius said:

                        If a dialog needs to have a specific size set to work correctly (because of dynamic content etc.)

                        I think dynamic 'context' is also a good reason.

                        I have a webdialog that changes it's position, size and content [based on where I moved it to] each open 'model space', SU can't handle that level of user choice.
                        john

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

                        1 Reply Last reply Reply Quote 0
                        • jolranJ Offline
                          jolran
                          last edited by

                          I think I'm going to consider this:

                          @unknownuser said:

                          Although it is possible we should be careful not to fiddle too much with window management without a good reason

                          Don't really have a good reason to use it. Just mucking around.

                          @unknownuser said:

                          I have a webdialog that changes it's position, size and content [based on where I moved it to] each open 'model space', SU can't handle that level of user choice.

                          Sounds really advanced. Responsive window.

                          1 Reply Last reply Reply Quote 0
                          • D Offline
                            driven
                            last edited by

                            @jolran said:

                            Sounds really advanced. Responsive window.

                            it's a prototype that seems to work on my mac, might find an excuse to finish it one day.
                            john

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

                            1 Reply Last reply Reply Quote 0
                            • 1 / 1
                            • First post
                              Last post
                            Buy SketchPlus
                            Buy SUbD
                            Buy WrapR
                            Buy eBook
                            Buy Modelur
                            Buy Vertex Tools
                            Buy SketchCuisine
                            Buy FormFonts

                            Advertisement