[plt-scheme] can't get caret-hiding working with selection

From: Robby Findler (robby at cs.uchicago.edu)
Date: Tue Apr 29 07:57:11 EDT 2008

On Tue, Apr 29, 2008 at 1:23 AM, Martin DeMello <martindemello at gmail.com> wrote:
> On Mon, Apr 28, 2008 at 4:12 AM, Robby Findler <robby at cs.uchicago.edu> wrote:
>
> > I think you want text:hide-caret/selection% from the framework.
>  >
>  >  You might want to use the lock method, rather than overriding the
>  >  can-insert? and can-delete? methods.
>
>  Follow on question:  I now have the following method
>
>  (define/public (insert-text text)
>         (send this lock #f)
>         (send this insert text)
>         (send this lock #t))
>
>  Why, within a method definition, do I need to say (send this lock #f)
>  rather than just (lock #f)?

If you include an `inherit' declaration for lock, then you can use the
lock method as a procedure (it is more efficient and has better error
checking than using "send this").

Eg:

(class text%
  (inherit lock insert)
  (define/public (insert-text str)
    (lock #f) (insert str) (lock #t))
  (super-new))


Robby


Posted on the users mailing list.