[squeak-dev] The Trunk: System-ul.494.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Aug 20 00:16:55 UTC 2012


Levente Uzonyi uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-ul.494.mcz

==================== Summary ====================

Name: System-ul.494
Author: ul
Time: 20 August 2012, 2:15:22.378 am
UUID: d402500d-3d26-6b45-997e-a2120e22c15e
Ancestors: System-ul.493

- improved the comment of Clipboard

=============== Diff against System-ul.493 ===============

Item was changed:
  Object subclass: #Clipboard
  	instanceVariableNames: 'contents recent interpreter'
  	classVariableNames: 'Default'
  	poolDictionaries: ''
  	category: 'System-Support'!
  
+ !Clipboard commentStamp: 'ul 8/20/2012 02:14' prior: 0!
- !Clipboard commentStamp: 'ul 8/16/2012 15:26' prior: 0!
  The Clipboard class implements a basic buffering scheme for text. The currently selected text is also exported to the OS so that text can be copied from and to other applications. Commonly only a single instance is used (the default clipboard) but applications are free to use other than the default clipboard if necessary.
  
  If you'd like to be notified of the changes of the clipboard, you can subscribe to it's #contentChanged event. For example:
  
- | subscriber |
  subscriber := [ :newClipboardText :updateSource | 
  	Transcript show: ('Clipboard was updated by {1}, the new content is: {2}'
  		format: {
  			updateSource.
  			newClipboardText }); cr ].
  Clipboard default
  	when: #contentChanged
  	send: #value:value:
  	to: subscriber.
+ 
+ At this point if you open a Transcript and copy or cut some text, then the message will appear on the Transcript. Make sure that there's a reference kept to subscriber, otherwise it will be garbage collected and no messages will appear.
  	
  To unsubscribe from the clipboard changes, just evaluate:
  
  Clipboard default removeActionsWithReceiver: subscriber!



More information about the Squeak-dev mailing list