[plt-scheme] can't get caret-hiding working with selection
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.
The caret-hidden? definition is creating a private field that is bound
to a procedure (it isn't a method and it isn't overriding anything).
Did you intend that?
Robby
On Sun, Apr 27, 2008 at 10:45 PM, Martin DeMello
<martindemello at gmail.com> wrote:
> I'm trying to define a read-only text% object in which text can be
> selected, but the caret never be displayed. Is this possible? Here's
> what I have so far - everything works, but the text can't be selected.
>
> (define read-only-text%
> (class text%
> (init-field (insertable? #t))
> (augment can-insert? can-delete?)
> (define (can-insert? s l) insertable?)
> (define (can-delete? s l) #f)
> (define (caret-hidden?) #t)
> (define/public (set-insertable b) (set! insertable? b))
> (super-instantiate ())
> (send this hide-caret #t)
> ))
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>