Thanks Max :) It works quickly, even with large files, but can be a major resource =20 hog. Using a text file with 112000 words, and a rate of 0, it =20 increased my CPU usage to 50%. Setting the rate to 10 reduced CPU =20 usage to 33%, rate 5 reduced CPU usage to around 18%, and rate 1 only =20 used about 8% (I had a number of other windows open, which accounted =20 for about 3% CPU usage.
Thorsten, use a slower rate, if it makes sense in your app (does the =20 update need to happen more often than once, or maybe 2-3 times per =20 second?). Quoting Maxim Olivier-Adlhoch <[email protected]>: > > Nick, > > that is such a nice trick :-) > > -MAx > > On Wed, Oct 7, 2009 at 11:29 PM, Nick Antonaccio <[email protected]> wrote: >> >> Hi Thorsten, >> >> You could just use a timer event on the info style: >> >> view layout [ >> =3DA0 =3DA0 i: info rate 0 feel [ >> =3DA0 =3DA0 =3DA0 =3DA0 engage: func [f a e] [ >> =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 if a =3D3D3D 'time [ >> =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 l: length? parse m/text n= one >> =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 i/text: join "Wordcount: = " l >> =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 show i >> =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 ] >> =3DA0 =3DA0 =3DA0 =3DA0 ] >> =3DA0 =3DA0 ] >> =3DA0 =3DA0 m: area >> ] >> >> HTH =3DA0:) >> >> - Nick >> >> >> Quoting Thorsten Moeller <[email protected]>: >> >>> >>> Hi, >>> >>> i am just writing a small editor for myself which should have a realtime >>> wordcount. Simplified i have following situation: >>> >>> editor: layout [ mytext: area ifo: info btn "Close" [unview]] >>> >>> view editor >>> >>> I am not too familiar with events in rebol. From the docs i learned that >>> i have to change the area definition to something like the following to >>> make the area react on key events: >>> >>> =3DA0 =3DA0 =3DA0mytext: area feel [ >>> =3DA0 =3DA0 =3DA0 =3DA0 engage: func [face action event] [ >>> =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 if action =3D3D3D 'key [mylen: lengt= h? parse mytex=3D > t/text none >>> =3D3D09=3D3D09=3D3D09 =3DA0 =3DA0 =3DA0ifo/text: join "Wordcount: " copy= to-string m=3D > ylen >>> =3D3D09=3D3D09=3D3D09 =3DA0 =3DA0 =3DA0show if >>> =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 = =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3D > =3DA0 =3DA0 ] >>> >>> But just adding the feel to the area doesn't work. >>> >>> What am i missing?? >>> >>> Thorsten >>> >>> >>> -- >>> http://www.fastmail.fm - IMAP accessible web-mail >>> >>> -- >>> To unsubscribe from the list, just send an email to >>> lists at rebol.com with unsubscribe as the subject. >>> >>> >> >> >> >> -- >> To unsubscribe from the list, just send an email to >> lists at rebol.com with unsubscribe as the subject. >> >> > -- > To unsubscribe from the list, just send an email to > lists at rebol.com with unsubscribe as the subject. > > -- To unsubscribe from the list, just send an email to lists at rebol.com with unsubscribe as the subject.
