|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.ide digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript electronics |
digitalmars.D.learn - Boxes - little boxes ,we all live in boxes
Well I have got something working at least . It builds three sets of three text
boxes and puts text in them . I didnt use the AA sugested or the Controls at
all yet !
Just overrode the setText() method and overloaded it also with different
parameters.
However It only shows one set of boxes,the first but I know the others are
there but hidden because the tab moves through nine fields
----------------------------------------------------------------------------------------------------------------
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;
import dwt.layout.GridLayout;
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);
GridLayout layout = new GridLayout;
parent.layout();
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 ();
}
May 08 2008
Could one of the kind gentlemen who answered previously please offer any suggestion? May 08 2008
June Wrote:Could one of the kind gentlemen who answered previously please offer any suggestion? May 08 2008
Chris R. Miller Wrote:June Wrote:Could one of the kind gentlemen who answered previously please offer any suggestion? May 09 2008
|