[plt-scheme] change-style

From: Robby Findler (robby at cs.uchicago.edu)
Date: Wed Jul 6 08:48:47 EDT 2005

I suspect you're changing the definitions text on some thread other
than drscheme's main eventspace thread. when you do that, you and the
syntax colorer are going to collide, and you end up with such contract

Probably you want to use queue-callback to run your insertions on
drscheme's main eventspace thread.


At Tue, 5 Jul 2005 20:57:08 +0200, Romain wrote:
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> Hello,
> I have a problem with the 299.106 version of DrScheme.
> I want to insert some text in the definitions window, so I did
> (send definitions-text insert "something"  0 'same #t)
> And then I want to color this.
> So I did
> (send definitions-text change-style (send (make-object style-delta%)
> set-delta-background color) 0 9))
> And sometimes it works, and most of the time DrScheme tells me
> sequence-contract-violation: negative: method change-style cannot be
> called, except in states (unlocked), args #<struct:style%> 9 10 #f
> I tried to wrap the color code with
> (send definitions-text can-change-style?)
> (send definitions-text is-locked?)
> (send definitions-text  locked-for-flow?)
> (send definitions-text  locked-for-read?)
> (send definitions-text  locked-for-write?)
> and they all said that I can change the style, but I still get the error.
> Thanks in advance for your help.
> Sincerly,
> Romain.

Posted on the users mailing list.