Getting access to the variables of an imported class

jicman cabrera_ at _wrc.xerox.com
Sat Dec 5 19:52:05 PST 2009


Greetings!

I have this program,

import dfl.all;
import myform2;
void main()
{
  Form d = new MyForm();
  d.text = "Hello...";
  //d.Name.text = "name";
  d.show();
}

that compiles fine.  Here is myform2 code:

/*
   Generated by Entice Designer
   Entice Designer written by Christopher E. Miller
   www.dprogramming.com/entice.php
*/

import dfl.all;


class MyForm: dfl.form.Form
{
  // Do not modify or move this block of variables.
  //~Entice Designer variables begin here.
  dfl.textbox.TextBox Name;
  //~Entice Designer variables end here.
 
 
  this()
  {
    initializeMyForm();
   
    //@  Other MyForm initialization code here.
   
  }
 
 
  private void initializeMyForm()
  {
    // Do not manually modify this function.
    //~Entice Designer 0.8.6pre4 code begins here.
    //~DFL Form
    text = "My Form";
    clientSize = dfl.all.Size(292, 273);
    //~DFL dfl.textbox.TextBox=Name
    Name = new dfl.textbox.TextBox();
    Name.name = "Name";
    Name.bounds = dfl.all.Rect(24, 8, 176, 24);
    Name.parent = this;
    //~Entice Designer 0.8.6pre4 code ends here.
  }
}

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 know this is not the DFL forum, but maybe this is a D trick that I am missing somewhere.

Any help would be greatly appreciated.

thanks,

josé





More information about the Digitalmars-d-learn mailing list