Webdialog component and group html attributes
-
I am trying to make a webdialog that updates with the selection, just like component options does, and sets the content of the attribute: ("dialog_product","html_code","#{value}").
So basicly, the dialog will be like a webpage for the component, the html is the valueDictionary;dialog_product Name;html_code Value;<html><body><a href=""><i>BUY HERE!!! 0.5mm x 0.37mm</i></a></body></html>
,the dialog, that updates with the selection, will do that value. Could someone help me?
-
Normally, you would wish to use an Observer to "make changes happen" in your webdialog.. however the SelectionObserver is still bugged.
-
You may try using the onSelectionBulkChange callback of a SelectionObserver custom subclasss, to trigger your changes. Then use the query methods of the Selection collection class (http://code.google.com/apis/sketchup/docs/ourdoc/selection.html) to determine if the selection is a single object (method single_object?), and if so test if it is an instance of Sketchup::ComponentInstance, and if it is.. whether it has an attribute dictionary of a certain name, and if so, make your changes.
-
@dan rathbun said:
Then use the query methods of the Selection collection class (http://code.google.com/apis/sketchup/docs/ourdoc/selection.html) to determine if the selection is a single object (method single_object?)
Note that
single_object?
will return true if you have a surface selected- which is multiple faces. To check if the selection really contains only one entity use thelength
property. -
Thanks, guys. I Hope I can get this to work.
Advertisement