MPEdit is a small MacPerl Text Editor module, the first version of which may be found (with many thanks to Vicki here) on: http://www.ptf.com/macperl/depts/Code/Tools&Misc./MPEdit_1.0.0.sea.hqx and listed on the Code page at http://www.ptf.com/macperl/depts/Code/index.html Here is a brief description of the module for those who might be thinking about whether to download it or not. The size of the folder is about 63k -- MPEdit.pm itself is about 17k. Essentially, the module gives MacPerl a new function MPE() for which the argument may be either a string or a reference to a file name. In either case, a new MPEdit window is opened with the string or contents of the file written to it. In this sense MPE() behaves similarly to the Perl print() function. The MPEdit window however functions as a fully fledged (that may be going a bit too far, but it has feathers enough at least to avoid crash landing) Text Editor. It has its own MenuBar with "File Menu" options of Open, Close, Save Save As and Quit plus "Edit Menu" options of Cut, Copy, Paste, Select All, Find and Find Again. Most of the Menu Bar options have 'command-key' equivalents. The contents of the MPEdit window (after an editing session) may be saved to the file it came from, or saved to a new file, just as with any ordinary text editor. In either case, or even if the contents of the window are not saved to disk, the text is returned to the calling program and can be retrieved by an assignment "$str = MPE()". The MPEdit window is an ordinary MacPerl window with one significant difference, namely that it is aware of its own existence. Hence a click in some other window (including another MacPerl window) will send MPEdit into the background and it will restore the Menu Bar to the original state. A click in the MPEdit window, if it is the background, will bring it to the front with the MenuBar changed back to display the MPEdit options. In this sense the MPEdit window behaves almost as though it belonged to a different application running in parallel with MacPerl. Otherwise, the MPEdit window behaves (hopefully) exactly as a Macintosh window should behave. It can be 'dragged', 'resized' and zoomed, and is equipped with functional scroll bars with proper 'tracking'. The body of text is scrolled automatically to keep either the caret or the text selected in a 'Find' somewhere in the visible region. The text can of course be scrolled manually but 'live scrolling' is not supported -- yet. There will probably be some bugs to be found in some or all of these routines. It is easier said than done. Session options, to do with window size and position, font, font size, line wrap and so forth, can be set by a statement at the beginning of the script using the module, if the the default values are unacceptable. Provision of a "preferences file" might be possible in the future. Three questions have arisen writing this script and I wonder if anyone has any comments on or answers to these points. Firstly I think DisposeMenu() is broken. In 'MPEdit.pm' a work-around of sorts stops (spectacular) crashes (in all cases I hope) but leaves a memory leak (I think). Secondly TECut/Copy/Paste transfers to and from _private_ scrap. IM suggests this behaviour is correct for unstyled text and goes on to say text can be transferred from private to desk scrap using TEToScrap(). The question is how? I cannot get it to work. Has anyone any experience in this area? It matters IMHO, since if there is no private scrap TEPaste() will take text from the desk scrap. The results of a 'Paste' can therefore sometimes be unexpected. Thirdly TEGetText() seems to be partly broken in so far as the handle points to garbage if there is no text in the field. A work-around is to look at 'teLength' and avoid the handle if 'teLength' is zero. Is it a bug, or is it expected behaviour? May I add two tributes. The first is to Matthias for the inticate and elegant structure of hooks and panes through which events weave their way through all the Toolbox modules. It is remarkable fact that despite its comprehensiveness, the design is such that if there is need to alter a corner of it for some particular purpose, it is possible to do so. The structure is not so to speak immutably set in concrete despite being complete in itself. It is a wonderfully flexible toolbox. The second tribute is to Vicki and Chris for MPPE which proves such an invaluable companion. Whatever it is you have forgotten, it is to be found therein (usually pretty easily), and whatever the problem it kicks you off succinctly in the right direction. So that's it. MPEdit attempts a TextEditor with a pipeline to and from MacPerl. Suggestions, comments, and criticism would be most welcome. Have fun with it! Alan Fry ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch