Getting access to the variables of an imported class

aalm a at a.a
Sat Dec 5 20:38:15 PST 2009


On Sun, 06 Dec 2009 05:52:05 +0200, jicman <cabrera_ at _wrc.xerox.com> wrote:

> However, when I "uncomment" the this line, //d.Name.text = "name";,
>
> import dfl.all;
> import myform2;
>
> void main()
> {
>   Form d = new MyForm();
>   d.text = "Hello...";
>   d.Name.text = "name";
>   d.show();
> }
>
> the compiler complains with,
>
> 19:46:19.65>build -I..;c:\D\dmd\import -version=gui -version=Phobos  
> testDFL.d
> testDFL.d(8): Error: no property 'Name' for type 'dfl.form.Form'
> testDFL.d(8): Error: no property 'text' for type 'int'
> testDFL.d(8): Error: constant 1.text is not an lvalue
> testDFL.d(8): Error: cannot implicitly convert expression ("name") of  
> type char[4u] to int

I dont have DFL installed, but try this:

import dfl.all;
import myform2;

void main()
{
   auto d = new MyForm();
   d.text = "Hello...";
   d.Name.text = "name";
   d.show();
}


More information about the Digitalmars-d-learn mailing list