Yong-Woong Kim wrote:

Hi, gurus!

 

I met with difficulty for building a VLE Extension.

 

My goal is to build a VLE Extension, to which users can take a class as its child.

 

First, I programmed the next class;

 

||----------------------------------------------------------------------------
|| /comp/PKG.BASEFORM/FRAMEWORK.BASEFORM.scurl
||----------------------------------------------------------------------------

{define-class public TBaseForm {inherits Dialog}
 
  field protected fr : Frame = {Frame width={make-elastic}, height={make-elastic}}
 
  {constructor public {default label:any="TBaseForm", ...}
   
    {construct-super       
        border-width=1px, border-color="black", border-style="flat",
        ...
    }
   
    {self.add replace?=true,
        {VBox width={make-elastic}, height={make-elastic}, background="",
            {CommandButton label=label},
            self.fr
        }
    }
  }
 
  {method public {add-child g:any}:void
    {self.fr.add replace?=true, g}
  }
}

||----------------------------------------------------------------------------

 

As you already noticed it from the source code, if users take a class as its child,
the class becomes a child of TBaseForm.fr : Frame.

 

Next, I successfully built TBaseForm to a VLE extension, so when I launched the VLE,
I can see its icon in the palettes and use it, too.

 

However, when I ran it after I took a RecordGrid on it by a drag and drop,
an error raised; "A TBaseForm may Contain only a single graphic child."

 

Before I ran it, I certainly saw that the RecordGrid was added as a child of TBaseForm
in the Layout tree.

 


I think the problem is that the TBaseForm constructor already adds a child (the CommandButton) to the TBaseForm object.  So then when the code generated by the VLE tries to add your RecordGrid object as a child of the TBaseForm, an error occurs because the TBaseForm already has a child object.

Why does the TBaseForm constructor add this CommandButton as a child of the TBaseForm object?

-Bert

Reply via email to