WebDialogs made with hashes don't store settings?
-
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, SU8M1Anyone else seeing this? Something obvious I'm missing?
-
This do work:
x = UI::WebDialog.new( 'HelloWorld' , false, 'test_foobar', 200, 100, 100, 200 ) x.show
-
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 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? -
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...
-
Jonathan Winterflood reported problems in the GoogleGroups.
http://groups.google.com/group/sketchupruby/t/acd135fbdff21068 -
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)`
-
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....
-
@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?
-
@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.
Advertisement