How to Create an HTMLRenderer as a child with ⎕NEW ?
3 posts
• Page 1 of 1
How to Create an HTMLRenderer as a child with ⎕NEW ?
The following is working as expected to create an HTMLRenderer as a children of a Form:
However, the following creates an error:
What would be the proper syntax to create an HTMLRenderer as a child of a Form using ⎕NEW ?
'F' ⎕WC 'Form'
'F.HR' ⎕WC 'HTMLRenderer' ('AsChild' 1)
However, the following creates an error:
F ← ⎕NEW ⊂'Form'
F.HR ← ⎕NEW 'HTMLRenderer' (⊂'AsChild' 1)
DOMAIN ERROR: The object could not be created
F.HR ← ⎕NEW'HTMLRenderer'(⊂'AsChild' 1)
∧
What would be the proper syntax to create an HTMLRenderer as a child of a Form using ⎕NEW ?
-
PGilbert - Posts: 439
- Joined: Sun Dec 13, 2009 8:46 pm
- Location: Montréal, Québec, Canada
Re: How to Create an HTMLRenderer as a child with ⎕NEW ?
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:
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.
If we want to specify a single property, it needs to be enclosed so as to make it depth 3 (or ¯3):
With multiple properties, the enclose isn't necessary:
Now, to create an HTMLRenderer as a child of the form, we need to call ⎕NEW in the context of the form:
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
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.
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
-
Brian|Dyalog - Posts: 119
- Joined: Thu Nov 26, 2009 4:02 pm
- Location: West Henrietta, NY
Re: How to Create an HTMLRenderer as a child with ⎕NEW ?
Thanks Brian, that's a super good explanation.
-
PGilbert - Posts: 439
- Joined: Sun Dec 13, 2009 8:46 pm
- Location: Montréal, Québec, Canada
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group