Dear Yong,

Actually, I did think that your problem had occurred when you ran your
applet after designing it using the VLE. However, it is very helpful to
have the contents of all the files that you included in your most recent
message.

The specific reason why an error was reported when you ran your applet
is because you tried to add a TextField to a TBaseForm object that
already contained a VBox. (I am sorry that in my earlier message I
mistakenly said that the TBaseForm contained a CommandButton.) Since
TBaseForm inherits from Frame, it can only have one child. When your
applet executes, the code generated by the VLE will cause the add method
of your TBaseForm object to be called with the TextField as the argument
(and without the replace?=true keyword argument). Since the TBaseForm
already contains an object (the VBox), an error is thrown. If you want
to solve this problem, you should remove the statement

{self.add
{VBox width={make-elastic}, height={make-elastic}, background="beige",
{CommandButton label=label},
self.fr
}
}

from the TBaseForm constructor.

I think perhaps your idea was that calling the add method on TBaseForm
should actually add an object to the internal Frame self.fr. If this is
what you want, you will need to override the add method of TBaseForm
like this:

{method public {add g:any, ...}:#Visual
{self.fr.add g, ...}
}

and change the self.add call in the TBaseForm constructor to

{self.add-internal
{VBox width={make-elastic}, height={make-elastic}, background="beige",
{CommandButton label=label},
self.fr
}
}

If you look at the documentation for the BaseFrame class, you will see
an example including a call to the add-internal method.

One other comment is that the {self.clear} call in the TBaseForm
constructor should not be needed. Based on my understanding of how you
are using it, the TBaseForm should not have any child objects at the
time when you call {self.clear}, and hence the {self.clear} call will be
a no-op.

-Bert


*******************************************
To unsubscribe from this list, send a mail to:
mailto:[EMAIL PROTECTED]
To contact a human list administrator, send a mail to:
mailto:[EMAIL PROTECTED]
To recieve a list of other options for this list, send a mail to:
mailto:[EMAIL PROTECTED]

Reply via email to