Hi Pierre!
This is a really good question. I too have been tripped up making the transition from ⎕WC to ⎕NEW when using the Dyalog GUI objects. It's important to remember two things when using ⎕NEW with GUI objects:
- when creating a child object it needs to be in the context of the parent object.
- The argument to ⎕NEW needs to be a 1 or 2 element array of [1] the type of the object and optionally [2] a depth 3 (or ¯3) array of child properties.
So, let's create a form...</br>
We need to enclose the argument since the first element of the argument to ⎕NEW needs to be the type of the object to be created. If we were to specify properties for the form, the initial enclose wouldn't be necessary.
f←⎕NEW ⊂'Form'
If we want to specify a single property, it needs to be enclosed so as to make it depth 3 (or ¯3):
f←⎕NEW 'Form' (⊂'Posn' (10 10))
With multiple properties, the enclose isn't necessary:
f←⎕NEW 'Form' (('Posn' (10 10))('Sizeable' 0))
Now, to create an HTMLRenderer as a child of the form, we need to call ⎕NEW in the context of the form:
f.(h←⎕NEW 'HTMLRenderer' (('AsChild' 1)('Posn'(0 0))('Size' (50 100))))
f.h is now a reference to the HTMLRenderer child.
Page 73 of the
Windows Interface Guide has a good example of using ⎕NEW instead of ⎕WC.
I hope this helps!
/Brian