[REBOL] Re: Rebol/View 'Key Event Problem
From: tmoeller:fastmail:fm at: 12-Oct-2009 9:30
Hi Nick,
thanks for your suggestions. I have to try it. I planned to have it in
realtime and made a test with Henrik's vid extensions. This worked well
for be but needs the extensions. I will give your trick a try as well,
together with the hints you provided. I don't think the single file will
become that large, but youll never know.
Thanks
Thorsten
On Sun, 11 Oct 2009 22:36 -0700, "Nick Antonaccio" <nick-guitarz.org>
wrote:
> Thanks Max :)
>
> It works quickly, even with large files, but can be a major resource
> hog. Using a text file with 112000 words, and a rate of 0, it
> increased my CPU usage to 50%. Setting the rate to 10 reduced CPU
> usage to 33%, rate 5 reduced CPU usage to around 18%, and rate 1 only
> used about 8% (I had a number of other windows open, which accounted
> for about 3% CPU usage.
>
> Thorsten, use a slower rate, if it makes sense in your app (does the
> update need to happen more often than once, or maybe 2-3 times per
> second?).
>
> Quoting Maxim Olivier-Adlhoch <moliad-gmail.com>:
>
> >
> > Nick,
> >
> > that is such a nice trick :-)
> >
> > -MAx
> >
> > On Wed, Oct 7, 2009 at 11:29 PM, Nick Antonaccio <nick-guitarz.org> wrote:
> >>
> >> Hi Thorsten,
> >>
> >> You could just use a timer event on the info style:
> >>
> >> view layout [
> >> =A0 =A0 i: info rate 0 feel [
> >> =A0 =A0 =A0 =A0 engage: func [f a e] [
> >> =A0 =A0 =A0 =A0 =A0 =A0 if a =3D 'time [
> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 l: length? parse m/text n
> one
> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 i/text: join "Wordcount:
> " l
> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 show i
> >> =A0 =A0 =A0 =A0 =A0 =A0 ]
> >> =A0 =A0 =A0 =A0 ]
> >> =A0 =A0 ]
> >> =A0 =A0 m: area
> >> ]
> >>
> >> HTH =A0:)
> >>
> >> - Nick
> >>
> >>
> >> Quoting Thorsten Moeller <tmoeller-fastmail.fm>:
> >>
> >>>
> >>> 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:
> >>>
> >>> =A0 =A0 =A0mytext: area feel [
> >>> =A0 =A0 =A0 =A0 engage: func [face action event] [
> >>> =A0 =A0 =A0 =A0 =A0 =A0 if action =3D 'key [mylen: lengt
> h? parse mytex
> > t/text none
> >>> =09=09=09 =A0 =A0 =A0ifo/text: join "Wordcount: " copy
> to-string m
> > ylen
> >>> =09=09=09 =A0 =A0 =A0show if
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0
> =A0 =A0 =A0 =A0 =A0 =A0
> > =A0 =A0 ]
> >>>
> >>> 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.
>
--
http://www.fastmail.fm - Access your email from home and the web