sketchucation logo sketchucation
    • Login
    ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

    WebDialogs made with hashes don't store settings?

    Scheduled Pinned Locked Moved Developers' Forum
    10 Posts 4 Posters 292 Views
    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.
    • thomthomT Offline
      thomthom
      last edited by

      h = { :dialog_title=>'helloworld', :left=>250, :top=>400, :width=>100, :height=>200, :preferences_key=>'foobar' } w = UI::WebDialog.new( h ) w.show

      This creates a Webdialog_foobar section in the registry, but doesn't store any position and size data.
      SU7.1, SU8M1

      Anyone else seeing this? Something obvious I'm missing?

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

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

        This do work:
        x = UI::WebDialog.new( 'HelloWorld' , false, 'test_foobar', 200, 100, 100, 200 ) x.show

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

        1 Reply Last reply Reply Quote 0
        • TIGT Offline
          TIG Moderator
          last edited by

          UI.WebDialog.new() accepts several arguments - why'd you think that passing a hash would work the same way ?
          It might not have been made that way ?
          The Getting and Setting of values isn't always interchangeable... πŸ˜•

          TIG

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

            @tig said:

            UI.WebDialog.new() accepts several arguments - why'd you think that passing a hash would work the same way ?
            It might not have been made that way ?
            The Getting and Setting of values isn't always interchangeable... πŸ˜•

            http://code.google.com/apis/sketchup/docs/releases.html

            @unknownuser said:

            Cleaner, hash-based syntax for initializing

            And I have previously asked a Googler about the preference key, as the docs where missing.
            And why would it create a registry category without filling it with the position and size settings?

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

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

              neither work here,

              although I think they did before the latest upgrade

              I also had to expand (add to) the html path on a couple of WD I was testing last week...

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

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

                Jonathan Winterflood reported problems in the GoogleGroups.
                http://groups.google.com/group/sketchupruby/t/acd135fbdff21068

                I'm not here much anymore.

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

                  repost from Google Groups

                  **I will say that the UI::WebDialog.new() method is "cranky" when it comes to processing arguments...**if you put nil as the pref_key arg, the method stops processing the remaining args. We discussed this in the API topic here at SCF. I think Jim found that omitting any arg cause the method to ignore the rest?

                  This is why I asked (Jonathan in my GG post,) if he specified all arguments... the argument processing for that method needs an overhaul !! (Perhaps the upgrade to Ruby 1.8.6 may have caused internal problems in the methods argument processing.)

                  Note that processing of a hash is also cranky... it doesn't work correctly if string keys are used (at least on SU 7.x,)

                  ...so I suggest use symbol keys and always give each key/value pair.

                  ` keys = {
                  :dialog_title => title,
                  :scrollable => false,
                  :preferences_key => 'MyDialog',
                  :height => 300,
                  :width => 400,
                  :left => 200,
                  :top => 200,
                  :resizable => true,
                  :mac_only_use_nswindow => true}

                  @dialog = UI::WebDialog.new(keys)`

                  I'm not here much anymore.

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

                    keys = { 
                    ;dialog_title => 'title', 
                    ;scrollable => false, 
                    ;preferences_key => 'MyDialog', 
                    ;height => 300, 
                    ;width => 400, 
                    ;left => 200, 
                    ;top => 200, 
                    ;resizable => true, 
                    ;mac_only_use_nswindow => true} 
                    
                    
                    @dialog = UI;;WebDialog.new(keys)
                    @dialog.show_modal
                    

                    hi Dan, it always starts back at the original size and position, no mater what you try...

                    has anyone got a working example of any WD that can be re-positioned...

                    thinking back. I've always set mine in ruby.

                    EDIT: Fredo's curiloft works properly on the Mac, but it's the only one I've found that does, but I can't workout how....

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

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

                      @driven said:

                      although I think they did before the latest upgrade

                      One of the changes, for SU 8 was an updated user agent string ... I wonder if that's causing this problem?

                      I'm not here much anymore.

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

                        @driven said:

                        although I think they did before the latest upgrade

                        I tried the hash in V7.1 - didn't work there either. Created the section key, but not any of the position and size keys.

                        @dan rathbun said:

                        I will say that the UI::WebDialog.new() method is "cranky" when it comes to processing arguments... if you put nil as the pref_key arg, the method stops processing the remaining args.

                        I tested that yesterday, Doesn't do that in SU8M1.

                        @dan rathbun said:

                        Note that processing of a hash is also cranky... it doesn't work correctly if string keys are used (at least on SU 7.x,)

                        Seems hashes with keys are cranky as well. I always use symbols.

                        @driven said:

                        has anyone got a working example of any WD that can be re-positioned...

                        You can always reposition and resize after you created the WD object. Note that, if you set a preference key, then the size and position you give in new will be ignored if there exist values in the registry.

                        @dan rathbun said:

                        One of the changes, for SU 8 was an updated user agent string ... I wonder if that's causing this problem?

                        I see the same problems in SU7.1. So it doesn't appear to be new. And I'd be surprised if the web control's user-agent-string affected the a ruby method.

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

                        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