Boxes ,little boxes We all live in them

June somewhere at so.com
Thu May 8 17:29:58 PDT 2008


I have experimented and used controls  and properties suggested but this is the only way I can get this to compile and produce anything . 

Still I cant get boxes two and three to show . This is what I want to do so can any previous guys help again please?

----------------------------------------------------------------------------------------------------------------------



module Box;
import dwt.DWT;
import dwt.widgets.Composite;
import dwt.widgets.Control;
import dwt.widgets.Text;
import dwt.widgets.Shell;
import dwt.widgets.Display;
import tango.io.Stdout;


class Box {
    Text One; //*****I dont see that these change anything
    Text Two;
    Text Three;
    private Control[ char[]  ] names; // Use associative array *********why-doesnt do anything more that I can see but this is probably how I get boxes 2 and 3 to show
    

this (Composite parent ,int style ) {
    auto box = new Composite(parent,DWT.SINGLE);
    
One = new Text(box,DWT.LEFT);
    One.setSize(50,20);
    One.setLocation(10,20);

Two = new Text(box,DWT.LEFT);
    Two.setSize(50,20);
    Two.setLocation(70,20);

Three   = new Text(box,DWT.LEFT);
    Three.setSize(50, 20);
    Three.setLocation(130,20);

    names["One"] = One;  //I'm not using this atm
    names["Two"] = Two;
    names["Three"]   = Three;

box.setSize (200,40);
box.setVisible(true);
}
  void setText(char[] text)
{ 
  setText(text);
  
}

  void setText(char[] text1, char[]text2, char[]text3 )
  {
    One.setText(text1);
    Two.setText(text2);
    Three.setText(text3);
    
   }
}

void main () {
  Display display = new Display ();
  Shell shell = new Shell (display);
  shell.setText("Boxes");
  
Box mybox1 = new Box(shell,DWT.SINGLE);
  mybox1.setText("screws","wire","bolts" );
  
Box mybox2 = new Box(shell,DWT.SINGLE);
  mybox2.setText("String","Fishingline","Rope");
  
Box mybox3 = new Box(shell,DWT.SINGLE);
  mybox3.setText("Tape","Glue","Spreaders");
  
  shell.pack();
  shell.open();        
  while (!shell.isDisposed ()) {
    if (!display.readAndDispatch ()) display.sleep ();
  }
  display.dispose ();
}



More information about the Digitalmars-d-learn mailing list