Hi, gurus!

 I am so sorry that my question was posted many times.
Yesterday my question didn't post although I send an e-mail.
I wonder what the problem came from my mail server or the CurlBreaker-I mail server. 

 By the way, come back to my VLE extension problem.
 Sriraman, Robert Halstead and Kamal Bhatt, I appreciate for your kind replies.
I am sorry that your replies are beside of the point of my problem,
so I need to explain more about my problem.

1. I want to build a VLE Extension of TBaseForm, to which users can add
a graphical object as its child and use it.

2. I wrote a class TBaseFrom and it pack in a package FRAMEWORK.BASEFORM.
   While the TBaseForm inheritted on the source code in my first question,
   I changed it to inherit Frame, but the result is the same.

||---------------------------------------------------------------------
|| Class : TBaseForm
|| Filename : FRAMEWORK.BASEFORM.scurl
|| Package : FRAMEWORK.BASEFORM
||---------------------------------------------------------------------
{define-class public TBaseForm {inherits Frame}
 
  field protected fr : Frame = {Frame width={make-elastic}, height={make-elastic}}
 
  || Constructor
  {constructor public {default label:any="TBaseForm", ...}
   
    {construct-super       
        border-width=1px, border-color="black", border-style="flat",
        ...
    }
   
    {self.clear}
   
    {self.add
        {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}
  }
}
||---------------------------------------------------------------------

2. I wrote the below source code to built TBaseForm to a VLE extension.

||---------------------------------------------------------------------
|| PKG.BASEFORM/FRAMEWORK.BASEFORM-ext.scurl
|| for building TBaseForm to a VLE extension
||---------------------------------------------------------------------
{curl-file-attributes character-encoding = "euc-kr"}
 
||| Do not remove the following comment.
||| File created by the VLE extension editor.  Do not remove this comment.
 

{import * from CURL.IMPLICIT.APPLET}
{import * from COM.CURL.LAYOUT-EDITOR.PALETTE-ITEMS}
 
{import * from FRAMEWORK.BASEFORM,
    location = {url "FRAMEWORK.BASEFORM.scurl"}
}
 

{define-class public open DesignTBaseForm {inherits DesignFrameContainer}
 
  || Purpose:
  || Construct a DesignDialog.
  ||
  || Comments:
  || The signature of this constructor is the same as that of the
  || DesignContainer constructor.
  {constructor public {default layout-container:LayoutContainer}
    {construct-super layout-container}
  }
 
  || Purpose:
  || Set up the graphic hierarchy for this container.
  ||
  || Comments:
  || Overrides DesignFrameContainer.init-child.
  {method protected open {init-child}:void
    set self.visible-frame = {TBaseForm}
    {self.add-internal self.visible-frame}
  }
 
  ||===== When users add or replace a object to this class, execute this...
  {method protected open {add-or-replace-child-with dg:DesignObject}:void
    let bf : TBaseForm = self.visible-frame asa TBaseForm
    {bf.add-child dg.graphic}
||--    {self.visible-frame.add dg.graphic}
||--    ||set self._border-frame.label = dg.graphic
||--    ||{self._border-frame.add replace?=true, dg.graphic}
  }
}
 
{define-class public open DesignTimeTBaseForm {inherits DesignTimeBaseFrameContainer}
 
  {constructor public {default}
    {construct-super
        {ObjectMetaData
            {MetaDataCategory
                name = {host-localize "Button"},
                label-pmd
            },           
            {MetaDataCategory
                name = {host-localize "General"},
                design-name-pmd,
                name-pmd,
                tooltip-pmd,
                use-look-and-feel?-pmd,
                halign-pmd,
                valign-pmd,
                hstretch?-pmd,
                vstretch?-pmd
            },
            standard-geometry-meta-data-category,
            {MetaDataCategory
                name = {host-localize "Colors"},
                color-pmd,
                background-pmd
            },
            standard-border-meta-data-category,
            standard-font-meta-data-category,
            ||""((
            {EventHandlerCategory
                {EventHandlerMetaData "Commit"},
                {EventHandlerMetaData "Reset"},
                {EventHandlerMetaData "PointerEnter"},
                {EventHandlerMetaData "PointerLeave"},
                {EventHandlerMetaData "PointerPress"},
                {EventHandlerMetaData "PointerRelease"},
                {EventHandlerMetaData "PointerMotion"},
                {EventHandlerMetaData "PointerScroll"},
                {EventHandlerMetaData "FocusIn"},
                {EventHandlerMetaData "FocusOut"},
                {EventHandlerMetaData "KeyPress"},
                {EventHandlerMetaData "DragStarted"},
                {EventHandlerMetaData "DragEnter"},
                {EventHandlerMetaData "DragLeave"},
                {EventHandlerMetaData "DragOver"},
                {EventHandlerMetaData "Drop"},
                {EventHandlerMetaData "AttachEvent"},
                {EventHandlerMetaData "DetachEvent"}
            }
            ||""))
        }
    }
  }
 
  {getter public open {runtime-class-name}:String
    {return "TBaseForm"} ||""
  }
 
  {getter public {palette-tab-name}:String
    {return {hlmessage YNCCFW}}
  }
 
  {method protected open {new-object element:LayoutElement}:Object
    {return {DesignTBaseForm element asa LayoutContainer}}
  }
 
  {getter protected {palette-graphic}:Graphic
    {return
        {image
            blocking? = true,
            source = {url "test.gif"}
        }
    }
  }
 
  {method public open {collect-import-descriptors layout-file:LayoutToolFile}:void
    {layout-file.add-import-descriptor
||--        {CopyImportDescriptor
||--            "FRAMEWORK.BASEFORM",
||--            {url "FRAMEWORK.BASEFORM.scurl"},
||--            dest-path = "vle-support-packages/FRAMEWORK.BASEFORM.scurl"
||--        }
       
        {DelegateImportDescriptor
            "FRAMEWORK.BASEFORM",
            version = "1.0",
            {url "../manifest.mcurl"}
        }
    }
  }
 
}
 
{register-palette-item DesignTimeTBaseForm}

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

Please, see the method {add-or-replace-child-with dg : DesignObject} in the class DesignTBaseForm. This part may help your misunderstanding
about my trouble.

I wrote the source code because I want to add a child to TBaseForm.fr : Frame instead of TBaseForm when users add a object to TBaseForm on the VLE as a child.

Until this step, I had had any problem. I built a TBaseForm VLE extention
successfully.

3. After that, I designed a vle container on the VLE to use my TBaseForm
extension. I add my TBaseForm on the vle container, then I add a TextField to the TBaseForm as a child of it. That is the below source code;

||---------------------------------------------------------------------
|| A VLE container using the built-in extension TBaseForm
||
||---------------------------------------------------------------------
{curl-file-attributes character-encoding = "euc-kr"}
 
{import * from FRAMEWORK.BASEFORM,
    version = "1.0"
}
 
|| Begin meta-data DO NOT EDIT
{import * from COM.CURL.LAYOUT-EDITOR.RUNTIME-SUPPORT,
    version = "3.0"
}
|| End meta-data
 
{define-layout-class MyContainer
    || Begin meta-data DO NOT EDIT
    format-version = 2,
    design-time-class = "Canvas",
    run-time-class = "Canvas",
    || End meta-data
    width = 315pt,
    height = 250pt,
    background = "",
    border-width = 1.5pt,
    border-color = "#D4D0C8",
    border-style = "raised",
    font-size = 8pt,
    control-appearance-changeable? = true, 

    ||------------------------------
    || TBaseForm
    ||------------------------------
    {layout-container void:TBaseForm
        || Begin meta-data DO NOT EDIT
        anchor = "top-left",
        x = 84pt,
        y = 42pt,
        || End meta-data
        {TBaseForm
            width = 174pt,
            height = 156pt,
 
            ||=================================================================
            || After I added this TextField by a drag & drop on the TBaseForm,
            || the VLE inserted this code.
            ||=================================================================
            {layout-element void:TextField
                {TextField
                }
            }
            ||=================================================================
        }
    }
 
    {constructor {default}
        {self.initialize-components}
    }
}
||---------------------------------------------------------------------
 
When I added this TextField to a TBaseForm by a drag & drop on  on the VLE, the TextField was added as a child of the  TBaseForm and the VLE inserted the below source code in the part of TBaseForm in the source code;

{layout-element void:TextField
 {TextField
 }
}

However, when I run it, an error occurred; "A TBaseForm may Contain only a single graphic child."

I think I infer the cause like this;

When I design on the VLE, the class DesignTBaseForm is run and it add
a layout-container:LayoutContainer as a child, so no error occurs.

In the actual running, the class TBaseForm is run and it cannot add a layout-container:LayoutContainer as a child, so the error occurs.

How can I solve this problem?

I tested that on Curl 4.0 beta.

If you know how to correct that problem, tell me please.
Besides, if you have any advices for me about that problem,
I welcome whatever they are.

Regards,

Yong

Reply via email to