View mode: basic / threaded / horizontal-split · Log in · Help
May 02, 2008
Re: For Chris
Tower  Ty Wrote:

> Tower  Ty Wrote:
> 
> > Nice new site ,quicker too ,
> > here is a line that you may be able to use and enhance-pretty basic though as yet

Glad you like it.  I know it doesn't let people post anonymously to forums, but I guess I can't have everything all in one package.  I think that this package has enough merit to stick with though. :-)

> > module Line;
> > import dwt.DWT;
> > import dwt.widgets.Composite;
> > import dwt.widgets.Text;
> > import dwt.widgets.Shell;
> > import dwt.widgets.Display;
> > import dwt.layout.RowLayout;
> > import dwt.events.ModifyEvent;
> > import dwt.events.ModifyListener;
> > import tango.io.Stdout;
> > import dwt.dwthelper.Integer;
> > 
> > 
> > class Line {
> >  public: this (Composite parent ,int style ) {
> >  
> >  auto line = new Composite(parent,style);
> >  line.setSize(700,40); 
> > //RowLayout layout= new RowLayout();
> >  //line.setLayout(layout);
> >  auto No = new Text(line,DWT.LEFT);
> >   No.setBounds(1,15,10,15);
> >   //No.setLocation(1,15);
> >   //No.setSize(10,15);
> >   No.setText("1");
> >   No.setEditable=true;
> >   No.setTextLimit(5);
> >   addTextListener(No);
> > 
> >  auto ChqDate = new Text(line,DWT.RIGHT);
> >   ChqDate.setBounds( 21, 15, 60, 15);
> >   ChqDate.setText = "10/04/08";
> >   ChqDate.setEditable = true;
> >   ChqDate.setTextLimit(8);
> >   
> >   addTextListener(ChqDate);
> > 
> >  auto ChqNo   = new Text(line,DWT.RIGHT); 
> >   ChqNo.setBounds( 90, 15,70, 15);
> >   ChqNo.setText = "123456789";
> >   ChqNo.setEditable = true;
> >   ChqNo.setTextLimit(20);
> >   addTextListener(ChqNo);
> >  
> > auto Details   = new Text(line,DWT.LEFT); 
> >   Details.setBounds( 170, 15,100, 15);
> >   Details.setText = "Bob the Builder  ";
> >   Details.setEditable = true;
> >   Details.setTextLimit(50);
> >   addTextListener(Details);
> >  
> > auto Code    = new Text(line,DWT.RIGHT);
> >   Code.setBounds( 280, 15, 30, 15);
> >   Code.setText = "340";
> >   Code.setEditable = true;
> >   Code.setTextLimit(4);
> >   addTextListener(Code);
> >  
> > auto Debit   = new Text(line,DWT.RIGHT) ;
> >   Debit.setBounds(320, 15,70, 15);
> >   Debit.setText = "1542.35";
> >   Debit.setEditable = true;
> >   Debit.setTextLimit(8);
> >   addTextListener(Debit);
> >  
> > auto Credit  = new Text(line,DWT.RIGHT) ;
> >   Credit.setBounds( 400, 15, 70, 15);
> >   Credit.setText = "0.00";
> >   Credit.setEditable = true;
> >   Credit.setTextLimit(8);
> >   addTextListener(Credit);
> > 
> > auto Balance = new Text(line,DWT.RIGHT) ;
> >   Balance.setBounds( 480, 15, 90, 15);
> >   Balance.setText = "1542.35";
> >   Balance.setEditable = true;
> >   Balance.setTextLimit(10) ;
> > 
> > //line.layout;
> > line.setVisible = true;
> > 
> > }
> > 
> > char values [][];
> > 
> > void addTextListener(Text text) {
> >     text.addModifyListener(new class(text) ModifyListener {
> >         Text text;
> >         this( Text text ){ this.text = text; }
> >         public void modifyText(ModifyEvent e){
> >             Integer index = cast(Integer)(this.text.getData("index"));
> >             values[index.intValue()] = this.text.getText();
> >         Stdout.print(e);     }    });     }
> > 
> > }
> Oh still working on the addTextListener()  causes seg v atm

I've just used "normal" listeners (dwt.widgets.Listener) and haven't had any trouble.  I did run into an interesting anachronism where Text.setText() wouldn't have any effect, but Text.selectAll() ; Text.insert(mystring) ; would work.  I would get angry and submit a bug report, but I saw the same kind of behavior all the time in Java, so I figured it was more deeply rooted.  I had a working fix, so what should I care?

I'll look into your code though.  It's supposed to work to input that data you were talking about, right?  It's late for my time zone - I should have been asleep hours ago - so I'll have to look into it in the morning.  Until then, Antaro Adun!
Top | Discussion index | About this forum | D home