Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Rebol/View 'Key Event Problem

From: tmoeller:fastmail:fm at: 7-Oct-2009 20:13

OK, i understand that. I downloaded the extension kit. Do you have a documentation for the kit somewhere. I searched for it but couldn't find and some link are already dead. Thorsten On Wed, 07 Oct 2009 19:27 +0200, "Henrik Mikael Kristensen" <henrikmk-gmail.com> wrote:
> On Wed, Oct 7, 2009 at 4:45 PM, Thorsten Moeller <tmoeller-fastmail.fm> > wro > te: > > > > 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 mytext: area feel [ > > =A0 =A0 =A0 =A0engage: func [face action event] [ > > =A0 =A0 =A0 =A0 =A0 =A0if action = 'key [mylen: length? parse mytext/te > xt none > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ifo/text: join > "Wordcount: " copy to-string mylen > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =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?? > > You are, with that code above, replacing the original engage function > for 'mytext, which contains all the text editing functions, so text > editing stops working. Other than that, your code would normally be > correct. Unfortunately there is no simple way in VID to just add an > on-key handler without rewriting the real engage function that is used > in the area style. You can see it like this: > > probe get in get in get-style 'area 'feel 'engage > > The solution is to modify that function and include it again. Cumbersome. > : > -) > > You can also download the VID Extension Kit, which lets you do your > task, like this: > > view make-window [ > ; ifo and if faces here > my-text: area on-key [ > act [ > mylen: length? parse mytext/text none > ifo/text: join "Wordcount: " copy to-string mylen > show if > ] > ] > ] > > It can be downloaded from here: > > http://97.107.135.89/www.hmkdesign.dk/rebol/vid/src/builds/vid-ext-kit.r > > -- > Regards, > Henrik Mikael Kristensen > -- > To unsubscribe from the list, just send an email to > lists at rebol.com with unsubscribe as the subject. >
-- http://www.fastmail.fm - Faster than the air-speed velocity of an unladen european swallow