Jump to page: 1 2
Thread overview
Listener output
Apr 19, 2008
Barry Denton
Apr 19, 2008
Bill Baxter
Apr 19, 2008
Barry Denton
Apr 19, 2008
Barry Denton
Apr 19, 2008
Bill Baxter
Apr 22, 2008
Barry Denton
Apr 22, 2008
Bill Baxter
Apr 22, 2008
Barry Denton
Apr 22, 2008
Bill Baxter
Apr 23, 2008
Barry Denton
Apr 24, 2008
Tower Ty
Apr 25, 2008
Bill Baxter
Apr 24, 2008
Tower Ty
Apr 22, 2008
Barry Denton
Apr 26, 2008
Tower Ty
Apr 19, 2008
Barry Denton
Apr 19, 2008
Barry Denton
April 19, 2008
I have a Listener added to a button as so :-

button.addListener(DWT.Selection, new class Listener {
        void handleEvent(Event event) {
            itemWords [5] = "item has changed " ;//~ System.currentTimeMillis();
            minitable.clear(5);  }  });

When pressed the button outputs this:-

Event {missing or misplaced '}'}Event {type=13 Button {Change item} time=1679601378 data={null} x=0 y=0 width=0 height=0 detail=0}
.
Now all is as it should be except for the  {missing or misplaced '}'}

1/ Can anybody see why I get this message?

Also "System.currentTimeMillis()"is a C style request .

2/  is there a similar request in D for a Linux machine?
April 19, 2008
Barry Denton wrote:
> I have a Listener added to a button as so :-
> 
> button.addListener(DWT.Selection, new class Listener {
>         void handleEvent(Event event) {
>             itemWords [5] = "item has changed " ;//~ System.currentTimeMillis();
>             minitable.clear(5);  }  }); 
> 
> When pressed the button outputs this:-
> 
> Event {missing or misplaced '}'}Event {type=13 Button {Change item} time=1679601378 data={null} x=0 y=0 width=0 height=0 detail=0}
> .
> Now all is as it should be except for the  {missing or misplaced '}'}

That's a Tango thing.  Functions like formatln must have all '{' chars escaped in the format string.  So you or DWT are using a tango string formatter somewhere you or DWT should probably not be.  It should be print() instead.  Yet another reason I don't love Tango for output.

> 1/ Can anybody see why I get this message? 
> 
> Also "System.currentTimeMillis()"is a C style request .

Looks more Java-style to me...

> 2/  is there a similar request in D for a Linux machine?

probably something in tango.time.Time.

How about this: tango.time.Time.Clock.now.time?

And if that doesn't work stick a few extra .time's .clock's or .now's on the end and see if it does.  ;-)

--bb
April 19, 2008
"Barry Denton" <basse42@yahoo.com> wrote in message news:fubgb0$22go$1@digitalmars.com...
>I have a Listener added to a button as so :-
>
> button.addListener(DWT.Selection, new class Listener {
>        void handleEvent(Event event) {
>            itemWords [5] = "item has changed " ;//~
> System.currentTimeMillis();
>            minitable.clear(5);  }  });
>
> When pressed the button outputs this:-
>
> Event {missing or misplaced '}'}Event {type=13 Button {Change item}
> time=1679601378 data={null} x=0 y=0 width=0 height=0 detail=0}
> .
> Now all is as it should be except for the  {missing or misplaced '}'}

Tango's formatting uses a pair of curly braces like "{}".  Your output is supposed to go "{Event {type=13....", but Tango sees the opening '{', tries to parse it as a format specifier, and fails, leaving you with an error message embedded in the output.

The question I have is: where is this output being generated?  This code doesn't seem to generate it.

I ask because it's a simple fix: instead of doing something like "Stdout.formatln(x.toString())", just use "Stdout.formatln("{}", x)", that is, escape the string by making it a parameter to be formatted.


April 19, 2008
Barry Denton Wrote:

> I have a Listener added to a button as so :-
> 
> button.addListener(DWT.Selection, new class Listener {
>         void handleEvent(Event event) {
>             itemWords [5] = "item has changed " ;//~ System.currentTimeMillis();
>             minitable.clear(5);  }  });
> 
> When pressed the button outputs this:-
> 
> Event {missing or misplaced '}'}Event {type=13 Button {Change item} time=1679601378 data={null} x=0 y=0 width=0 height=0 detail=0}
> .
> Now all is as it should be except for the  {missing or misplaced '}'}
> 
> 1/ Can anybody see why I get this message?
> 
> Also "System.currentTimeMillis()"is a C style request .
> 
> 2/  is there a similar request in D for a Linux machine?


Ended up using Tango book solution for current date display -Time too complex

import tango.time.WallClock;
import tango.text.locale.Locale;

auto layout = new Locale;
Stdout.print(layout ("{:ddd, dd MMMM yyyy HH':'mm':'ss z}", WallClock.now)).newline;


April 19, 2008
Jarrett Billingsley Wrote:

> "Barry Denton" <basse42@yahoo.com> wrote in message news:fubgb0$22go$1@digitalmars.com...
> >I have a Listener added to a button as so :-
> >
> > button.addListener(DWT.Selection, new class Listener {
> >        void handleEvent(Event event) {
> >            itemWords [5] = "item has changed " ;//~
> > System.currentTimeMillis();
> >            minitable.clear(5);  }  });
> >
> > When pressed the button outputs this:-
> >
> > Event {missing or misplaced '}'}Event {type=13 Button {Change item}
> > time=1679601378 data={null} x=0 y=0 width=0 height=0 detail=0}
> > .
> > Now all is as it should be except for the  {missing or misplaced '}'}
> 
> Tango's formatting uses a pair of curly braces like "{}".  Your output is supposed to go "{Event {type=13....", but Tango sees the opening '{', tries to parse it as a format specifier, and fails, leaving you with an error message embedded in the output.
> 
> The question I have is: where is this output being generated?  This code doesn't seem to generate it.
> 
> I ask because it's a simple fix: instead of doing something like "Stdout.formatln(x.toString())", just use "Stdout.formatln("{}", x)", that is, escape the string by making it a parameter to be formatted.
> 
> 
Thanks but this did not work .Did I mess it up?
 button.addListener(DWT.Selection, new class Listener {
        void handleEvent(Event event) {
            itemWords [5] = ("item has changed " ~ clock.stringof~"  "~ cast(char)clock);
            Stdout.formatln("{}""{}" ,event.mangleof, event.stringof).newline;
            Stdout.formatln("{}""{}" ,clock.mangleof, clock.stringof).newline;
            Stdout.print(itemWords).newline;
            minitable.clear(5);

April 19, 2008
Jarrett Billingsley Wrote:

> "Barry Denton" <basse42@yahoo.com> wrote in message news:fubgb0$22go$1@digitalmars.com...
> >I have a Listener added to a button as so :-
> >
> > button.addListener(DWT.Selection, new class Listener {
> >        void handleEvent(Event event) {
> >            itemWords [5] = "item has changed " ;//~
> > System.currentTimeMillis();
> >            minitable.clear(5);  }  });
> >
> > When pressed the button outputs this:-
> >
> > Event {missing or misplaced '}'}Event {type=13 Button {Change item}
> > time=1679601378 data={null} x=0 y=0 width=0 height=0 detail=0}
> > .
> > Now all is as it should be except for the  {missing or misplaced '}'}
> 
> Tango's formatting uses a pair of curly braces like "{}".  Your output is supposed to go "{Event {type=13....", but Tango sees the opening '{', tries to parse it as a format specifier, and fails, leaving you with an error message embedded in the output.
> 
> The question I have is: where is this output being generated?  This code doesn't seem to generate it.
> 
> I ask because it's a simple fix: instead of doing something like "Stdout.formatln(x.toString())", just use "Stdout.formatln("{}", x)", that is, escape the string by making it a parameter to be formatted.
> 
> 
Oh and output seems to be generated by the selection itself The output from the above is

C3dwt7widgets5Event5Eventevent

PS5tango4time9WallClock9WallClockclock

[ item 0  , item 1  , item 2  , item 3  , item 4  , item has changed clock  , item 6  , item 7  , item 8  , item 9   ] Event {missing or misplaced '}'}Event {type=36 Table {} time=1752657025 data={null} x=0 y=0 width=0 height=0 detail=0}

(note there is no output  for event.stringof or for clock.stringof -a blank line So I'l try formating the event and see

April 19, 2008
Barry Denton Wrote:

> Jarrett Billingsley Wrote:
> 
> > "Barry Denton" <basse42@yahoo.com> wrote in message news:fubgb0$22go$1@digitalmars.com...
> > >I have a Listener added to a button as so :-
> > >
> > > button.addListener(DWT.Selection, new class Listener {
> > >        void handleEvent(Event event) {
> > >            itemWords [5] = "item has changed " ;//~
> > > System.currentTimeMillis();
> > >            minitable.clear(5);  }  });
> > >
> > > When pressed the button outputs this:-
> > >
> > > Event {missing or misplaced '}'}Event {type=13 Button {Change item}
> > > time=1679601378 data={null} x=0 y=0 width=0 height=0 detail=0}
> > > .
> > > Now all is as it should be except for the  {missing or misplaced '}'}
> > 
> > Tango's formatting uses a pair of curly braces like "{}".  Your output is supposed to go "{Event {type=13....", but Tango sees the opening '{', tries to parse it as a format specifier, and fails, leaving you with an error message embedded in the output.
> > 
> > The question I have is: where is this output being generated?  This code doesn't seem to generate it.
> > 
> > I ask because it's a simple fix: instead of doing something like "Stdout.formatln(x.toString())", just use "Stdout.formatln("{}", x)", that is, escape the string by making it a parameter to be formatted.
> > 
> > 
> Thanks but this did not work .Did I mess it up?
>  button.addListener(DWT.Selection, new class Listener {
>         void handleEvent(Event event) {
>             itemWords [5] = ("item has changed " ~ clock.stringof~"  "~ cast(char)clock);
>             Stdout.formatln("{}""{}" ,event.mangleof, event.stringof).newline;
>             Stdout.formatln("{}""{}" ,clock.mangleof, clock.stringof).newline;
>             Stdout.print(itemWords).newline;
>             minitable.clear(5);
> 
Tried this but still there

button.addListener(DWT.Selection, new class Listener {
        void handleEvent(Event event) {
            itemWords [5] = ("item has changed " ~ clock.stringof~"  "~ cast(char)clock);
            Stdout.formatln("{}""{}" ,event.mangleof, event.stringof).newline;
            Stdout.formatln("{}""{}" ,clock.mangleof, clock.stringof).newline;
            Stdout.formatln("{}",event);
            Stdout.print(itemWords).newline;
            minitable.clear(5);
Output
C3dwt7widgets5Event5Eventevent

PS5tango4time9WallClock9WallClockclock

Event {missing or misplaced '}'}Event {type=13 Button {Change item at index 5} time=1753196186 data={null} x=0 y=0 width=0 height=0 detail=0}
[ item 0  , item 1  , item 2  , item 3  , item 4  , item has changed clock  , item 6  , item 7  , item 8  , item 9   ]
Event {missing or misplaced '}'}Event {type=36 Table {} time=1753196186 data={null} x=0 y=0 width=0 height=0 detail=0}

April 19, 2008
Barry Denton wrote:
> Barry Denton Wrote:
> 
>> Jarrett Billingsley Wrote:
>>
>>> "Barry Denton" <basse42@yahoo.com> wrote in message news:fubgb0$22go$1@digitalmars.com...
>>>> I have a Listener added to a button as so :-
>>>>
>>>> button.addListener(DWT.Selection, new class Listener {
>>>>        void handleEvent(Event event) {
>>>>            itemWords [5] = "item has changed " ;//~ System.currentTimeMillis();
>>>>            minitable.clear(5);  }  });
>>>>
>>>> When pressed the button outputs this:-
>>>>
>>>> Event {missing or misplaced '}'}Event {type=13 Button {Change item} time=1679601378 data={null} x=0 y=0 width=0 height=0 detail=0}
>>>> .
>>>> Now all is as it should be except for the  {missing or misplaced '}'}
>>> Tango's formatting uses a pair of curly braces like "{}".  Your output is supposed to go "{Event {type=13....", but Tango sees the opening '{', tries to parse it as a format specifier, and fails, leaving you with an error message embedded in the output.
>>>
>>> The question I have is: where is this output being generated?  This code doesn't seem to generate it.
>>>
>>> I ask because it's a simple fix: instead of doing something like "Stdout.formatln(x.toString())", just use "Stdout.formatln("{}", x)", that is, escape the string by making it a parameter to be formatted. 
>>>
>>>
>> Thanks but this did not work .Did I mess it up?
>>  button.addListener(DWT.Selection, new class Listener {
>>         void handleEvent(Event event) {
>>             itemWords [5] = ("item has changed " ~ clock.stringof~"  "~ cast(char)clock);
>>             Stdout.formatln("{}""{}" ,event.mangleof, event.stringof).newline;
>>             Stdout.formatln("{}""{}" ,clock.mangleof, clock.stringof).newline;
>>             Stdout.print(itemWords).newline;
>>             minitable.clear(5); 
>>
> Tried this but still there
> 
> button.addListener(DWT.Selection, new class Listener {
>         void handleEvent(Event event) {
>             itemWords [5] = ("item has changed " ~ clock.stringof~"  "~ cast(char)clock);
>             Stdout.formatln("{}""{}" ,event.mangleof, event.stringof).newline;
>             Stdout.formatln("{}""{}" ,clock.mangleof, clock.stringof).newline;
>             Stdout.formatln("{}",event);
>             Stdout.print(itemWords).newline;
>             minitable.clear(5); Output
> C3dwt7widgets5Event5Eventevent
> 
> PS5tango4time9WallClock9WallClockclock
> 
> Event {missing or misplaced '}'}Event {type=13 Button {Change item at index 5} time=1753196186 data={null} x=0 y=0 width=0 height=0 detail=0}
> [ item 0  , item 1  , item 2  , item 3  , item 4  , item has changed clock  , item 6  , item 7  , item 8  , item 9   ]
> Event {missing or misplaced '}'}Event {type=36 Table {} time=1753196186 data={null} x=0 y=0 width=0 height=0 detail=0}
> 

The problem is in dwt's dwt/widgets/Event.d, toString method:

override public char[] toString () {
    return Format( "Event {type={} {} time={} data={} x={} y={} width={} height={} detail={}}",
        type, widget, time, data, x, y, width, height, detail ); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
}

It needs to escape the first and last '{'s.
Can you fix it, Frank?

--bb
April 22, 2008
Bill Baxter Wrote:

> Barry Denton wrote:
> > Barry Denton Wrote:
> > 
> >> Jarrett Billingsley Wrote:
> >>
> >>> "Barry Denton" <basse42@yahoo.com> wrote in message news:fubgb0$22go$1@digitalmars.com...
> >>>> I have a Listener added to a button as so :-
> >>>>
> >>>> button.addListener(DWT.Selection, new class Listener {
> >>>>        void handleEvent(Event event) {
> >>>>            itemWords [5] = "item has changed " ;//~
> >>>> System.currentTimeMillis();
> >>>>            minitable.clear(5);  }  });
> >>>>
> >>>> When pressed the button outputs this:-
> >>>>
> >>>> Event {missing or misplaced '}'}Event {type=13 Button {Change item}
> >>>> time=1679601378 data={null} x=0 y=0 width=0 height=0 detail=0}
> >>>> .
> >>>> Now all is as it should be except for the  {missing or misplaced '}'}
> >>> Tango's formatting uses a pair of curly braces like "{}".  Your output is supposed to go "{Event {type=13....", but Tango sees the opening '{', tries to parse it as a format specifier, and fails, leaving you with an error message embedded in the output.
> >>>
> >>> The question I have is: where is this output being generated?  This code doesn't seem to generate it.
> >>>
> >>> I ask because it's a simple fix: instead of doing something like "Stdout.formatln(x.toString())", just use "Stdout.formatln("{}", x)", that is, escape the string by making it a parameter to be formatted.
> >>>
> >>>
> >> Thanks but this did not work .Did I mess it up?
> >>  button.addListener(DWT.Selection, new class Listener {
> >>         void handleEvent(Event event) {
> >>             itemWords [5] = ("item has changed " ~ clock.stringof~"  "~ cast(char)clock);
> >>             Stdout.formatln("{}""{}" ,event.mangleof, event.stringof).newline;
> >>             Stdout.formatln("{}""{}" ,clock.mangleof, clock.stringof).newline;
> >>             Stdout.print(itemWords).newline;
> >>             minitable.clear(5);
> >>
> > Tried this but still there
> > 
> > button.addListener(DWT.Selection, new class Listener {
> >         void handleEvent(Event event) {
> >             itemWords [5] = ("item has changed " ~ clock.stringof~"  "~ cast(char)clock);
> >             Stdout.formatln("{}""{}" ,event.mangleof, event.stringof).newline;
> >             Stdout.formatln("{}""{}" ,clock.mangleof, clock.stringof).newline;
> >             Stdout.formatln("{}",event);
> >             Stdout.print(itemWords).newline;
> >             minitable.clear(5);
> > Output
> > C3dwt7widgets5Event5Eventevent
> > 
> > PS5tango4time9WallClock9WallClockclock
> > 
> > Event {missing or misplaced '}'}Event {type=13 Button {Change item at index 5} time=1753196186 data={null} x=0 y=0 width=0 height=0 detail=0}
> > [ item 0  , item 1  , item 2  , item 3  , item 4  , item has changed clock  , item 6  , item 7  , item 8  , item 9   ]
> > Event {missing or misplaced '}'}Event {type=36 Table {} time=1753196186 data={null} x=0 y=0 width=0 height=0 detail=0}
> > 
> 
> The problem is in dwt's dwt/widgets/Event.d, toString method:
> 
> override public char[] toString () {
>      return Format( "Event {type={} {} time={} data={} x={} y={}
> width={} height={} detail={}}",
>          type, widget, time, data, x, y, width, height, detail );
> //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
> //$NON-NLS-6$ //$NON-NLS-7$
> }
> 
> It needs to escape the first and last '{'s.
> Can you fix it, Frank?
> 
> --bb
Will result be rest of  fields then filled in ?
April 22, 2008
Bill Baxter Wrote:

> Barry Denton wrote:
> > Barry Denton Wrote:
> > 
> >> Jarrett Billingsley Wrote:
> >>
> >>> "Barry Denton" <basse42@yahoo.com> wrote in message news:fubgb0$22go$1@digitalmars.com...
> >>>> I have a Listener added to a button as so :-
> >>>>
> >>>> button.addListener(DWT.Selection, new class Listener {
> >>>>        void handleEvent(Event event) {
> >>>>            itemWords [5] = "item has changed " ;//~
> >>>> System.currentTimeMillis();
> >>>>            minitable.clear(5);  }  });
> >>>>
> >>>> When pressed the button outputs this:-
> >>>>
> >>>> Event {missing or misplaced '}'}Event {type=13 Button {Change item}
> >>>> time=1679601378 data={null} x=0 y=0 width=0 height=0 detail=0}
> >>>> .
> >>>> Now all is as it should be except for the  {missing or misplaced '}'}
> >>> Tango's formatting uses a pair of curly braces like "{}".  Your output is supposed to go "{Event {type=13....", but Tango sees the opening '{', tries to parse it as a format specifier, and fails, leaving you with an error message embedded in the output.
> >>>
> >>> The question I have is: where is this output being generated?  This code doesn't seem to generate it.
> >>>
> >>> I ask because it's a simple fix: instead of doing something like "Stdout.formatln(x.toString())", just use "Stdout.formatln("{}", x)", that is, escape the string by making it a parameter to be formatted.
> >>>
> >>>
> >> Thanks but this did not work .Did I mess it up?
> >>  button.addListener(DWT.Selection, new class Listener {
> >>         void handleEvent(Event event) {
> >>             itemWords [5] = ("item has changed " ~ clock.stringof~"  "~ cast(char)clock);
> >>             Stdout.formatln("{}""{}" ,event.mangleof, event.stringof).newline;
> >>             Stdout.formatln("{}""{}" ,clock.mangleof, clock.stringof).newline;
> >>             Stdout.print(itemWords).newline;
> >>             minitable.clear(5);
> >>
> > Tried this but still there
> > 
> > button.addListener(DWT.Selection, new class Listener {
> >         void handleEvent(Event event) {
> >             itemWords [5] = ("item has changed " ~ clock.stringof~"  "~ cast(char)clock);
> >             Stdout.formatln("{}""{}" ,event.mangleof, event.stringof).newline;
> >             Stdout.formatln("{}""{}" ,clock.mangleof, clock.stringof).newline;
> >             Stdout.formatln("{}",event);
> >             Stdout.print(itemWords).newline;
> >             minitable.clear(5);
> > Output
> > C3dwt7widgets5Event5Eventevent
> > 
> > PS5tango4time9WallClock9WallClockclock
> > 
> > Event {missing or misplaced '}'}Event {type=13 Button {Change item at index 5} time=1753196186 data={null} x=0 y=0 width=0 height=0 detail=0}
> > [ item 0  , item 1  , item 2  , item 3  , item 4  , item has changed clock  , item 6  , item 7  , item 8  , item 9   ]
> > Event {missing or misplaced '}'}Event {type=36 Table {} time=1753196186 data={null} x=0 y=0 width=0 height=0 detail=0}
> > 
> 
> The problem is in dwt's dwt/widgets/Event.d, toString method:
> 
> override public char[] toString () {
>      return Format( "Event {type={} {} time={} data={} x={} y={}
> width={} height={} detail={}}",
>          type, widget, time, data, x, y, width, height, detail );
> //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
> //$NON-NLS-6$ //$NON-NLS-7$
> }
> 
> It needs to escape the first and last '{'s.
> Can you fix it, Frank?
> 
> --bb
Will result be rest of  fields then filled in ?
« First   ‹ Prev
1 2