digitalmars.D - For Chris
- Tower Ty (2/2) Apr 30 2008 Nice new site ,quicker too ,
- Tower Ty (2/100) Apr 30 2008 Oh still working on the addTextListener() causes seg v atm
- Pragma (3/7) May 01 2008 Ya know, I don't think I'll ever get used to seeing SWT code written in ...
- Chris R. Miller (4/104) May 02 2008 I've just used "normal" listeners (dwt.widgets.Listener) and haven't had...
Nice new site ,quicker too , here is a line that you may be able to use and enhance-pretty basic though as yet
Apr 30 2008
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 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
Apr 30 2008
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 [DWT code sample snipped]Ya know, I don't think I'll ever get used to seeing SWT code written in D. It's just such an eerily powerful thing. - Pragma
May 01 2008
Tower Ty Wrote:Tower Ty Wrote: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. :-)Nice new site ,quicker too , here is a line that you may be able to use and enhance-pretty basic though as yetI'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!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
May 02 2008