summaryrefslogtreecommitdiffstats
path: root/mac/README
blob: 7d81595cfb33056287e2b03af408148099c262d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
Tk 8.1 for Macintosh

by Ray Johnson
Scriptics Corporation
rjohnson@scriptics.com
with major help from
Jim Ingham
Cygnus Solutions
jingham@cygnus.com

RCS: @(#) $Id: README,v 1.8 1999/04/16 01:51:29 stanton Exp $

1. Introduction
---------------

This is the README file for the Macintosh version of the Tk
extension for the Tcl scripting language.  The file consists of
information specific to the Macintosh version of Tcl and Tk.  For more
general information please read the README file in the main Tk
directory.

2. What's new?
-------------

All the widgets will now display internationalized text!

The widget configuration package has been changed to support the new object
model introduced with the 8.0 compiler.  For now the old configuration
package is retained, and in fact, only the menu and button widgets use
the new package.

3. Mac specific features
------------------------

There are several features or enhancements in Tk that are unique to 
the Macintosh version of Tk.  Here is a list of those features and
pointers to where you can find more information about the feature.

* The menu command has special rules for accessing the Macintosh
  Apple and Help menus.  See the menu.m man page for details.

* If you have the special Tcl function "tkAboutDialog" defined, it
  will be called instead of displaying the default About Box in the
  console or other parts of the Wish application.  See below for
  details.

* In addition to the standard X cursors, the Mac version of Tk will
  let you use any Mac cursor that is named and installed in your
  application.  See the GetCursor.3 man page for details.

* The wish application has a couple of hooks to know about the exit,
  "open document" and "Do Script"  Mac High Level events.  
  See below for details.

* The command unsupported1 will allow you to set the style of new
  toplevel windows on the Macintosh.  It is not really supported.
  See below for details.

* In addition to the standard built-in bitmaps that Tk supports, the
  Mac version of Tk allows you to use several Mac specific icons.  See
  the GetBitmap.3 man page for a complete list.

* The send command works among interpreters in the same application.  We hope to
  have the complete implementation available in Tk 8.1.

* The -use and -container options almost work. The focus bugs that
  were in Tk8.0 final have been fixed.  But there are still some
  known bugs that cause some major problems.  Be careful, if you
  decide to use these features.  (See bugs.doc for details.)

4. The Distribution
-------------------

Macintosh Tk is distributed in three different forms.  This 
should make it easier to only download what you need.  The 
packages are as follows:

mactk8.1.sea.hqx

    This distribution is a "binary" only release.  It contains an
    installer program that will install a 68k, PowerPC, or Fat
    version of the "Wish" application.  In addition, in installs
    the Tcl & Tk libraries in the Extensions folder inside your
    System Folder.  (No "INIT"'s or Control Pannels are installed.)

mactcltk-full-8.1.sea.hqx

    This release contains the full release of Tcl and Tk for the
    Macintosh plus the More Files package on which Macintosh Tcl and
    Tk rely.

mactk-source-8.1.sea.hqx

    This release contains the complete source to Tk for the Macintosh
    In addition, Metrowerks CodeWarrior libraries and project files
    are included.  However, you must already have the More Files
    package to compile this code.

5. Documentation
----------------

There are now many books available for Tcl.  These two provide a good
introduction to the language.  It is a good way to get started
if you haven't used the language before:

    Title:			Tcl and the Tk Toolkit
    Author:			John K. Ousterhout
    Publisher:			Addison-Wesley
    ISBN:			0-201-63337-X

    Title:			Practical Programming in Tcl and Tk
    Author:			Brent Welch
    Publisher:			Prentice Hall
    ISBN:			0-13-182007-9

More books are listed at
    http://www.scriptics.com/resource/doc/books/

The "doc" subdirectory contains reference in documentation
in the "man" format found on most UNIX machines.  Unfortunately,
there is not a suitable way to view these pages on the Macintosh.  
A version suitable for viewing on the Macintosh has yet to be
developed.  We are working are having better documentation for
the Macintosh platform in the future.  However, if you have WWW 
access you may access the Man pages at the following URL:

	http://www.scriptics.com/man/tcl8.1/contents.html

Other documentation and sample Tcl scripts can be found at
the Tcl ftp site: 

	ftp://ftp.neosoft.com/tcl/

The internet news group comp.lang.tcl is also a valuable
source of information about Tcl.  A mailing list is also
available (see below).

6. Compiling Tk
---------------

In order to compile Macintosh Tk you must have the 
following items:

	CodeWarrior Pro 3 or higher
	Mac Tcl 8.1 (source)
	  (which requires More Files 1.4.2 or 1.4.3)
	Mac Tk 8.1 (source)

The project  files included with the Mac Tcl source should work 
fine.  The only thing you may need to update are the access paths.
As with Tcl, you need to upgrade to the 2.0.1 version of the C
compilers or later to build the CFM68K version of Tcl/Tk.

Special notes:

* Check out the file bugs.doc for information about known bugs.

* We are starting to support the new Appearance Manager that shipped
  with MacOS 8.0.  The Tk 8.0.3 release is the first Tk release
  that supports the Appearance Manager well.  Tk 8.0.4 extends this support
  to the menu system, though you have to have Appearance 1.0.1 or later
  installed for this to work.
  
* If you get the Unix tar file, it will untar into a directory tcl8.0.4.  However,
  the Macintosh project files expect the folder to be called tcl8.0.  You will need
  to rename the folder to tcl8.0, or change all the paths in the project files.


7. About Dialog
---------------

The prefered method for replacing the about dialog is to replace the
main menubar of the application, using the -menu option for the "."
window.  Then add a cascade called .mainMenu.apple to your mainMenu,
and you can put an about item in here WITH YOUR OWN LABEL!

8. Apple Events
---------------

Tcl/Tk currently doesn't have much in the way of support for Mac
Apple Events.  There is no way to send an apple event (although you
could write an extension to do this) and no general purpose way to
recieve apple events.  However, there are a couple of hooks for
dealing with some of the standard apple events.

    exit - Generally, Tcl cleans up after it self when you exit.
	However, your application may want to do application specifc
	cleanup like saving a users data.  To do this you can rename
	the exit command to something else.  Define your own exit
	command to do whatever clean up you like and then call the
	origional exit command.  For example,

		rename exit __exit
		proc exit {} {
		  # Do your clean up hear
		  __exit
		}

	Both incoming quit events and hitting the Quit menu item
	will call the exit command.  However, don't expect you can
	abort the exit.  Tk may exit anyway if the exit command it
	calls does not actually quit the application.

    open - The other apple event Tk supports is the open event.  The
	open event is sent to Tk if, for example, you drop a file on
	the Wish icon.  If you define a Tcl procedure with the name
	"tkOpenDocument" it will be invoked on any Open Document
	events that the application receives.  The a list of paths to
	the various documents will be passed to the Tcl function.
	Here is an example,

		proc tkOpenDocument args {
		  foreach file $args {
		    # Deal with passed in file path
		  }
		}

	Note: This isn't every thing you need to do to make your
	application dropable.  You must still define a FREF resource
	that makes sense for your application domain.  (Out of the
	box, you will not be able to drop files on the Wish
	application.  See the Inside Macintosh documentation for
	details about the FREF resource.
	
    do script - This is a way for external applications to drive MacTk, or
        to recieve information from it.  From AppleScript, you can say:
        
                tell application "Wish8.0"
	            do script "console hide
	                pack [button .b1 -text {Hello world} -command exit]"
                end tell
                
        which will get Tk to run the canonical hello world application.
                
8. unsupported1
---------------

The unsupported1 command is a short term hack we made available to
allow you to set the window style of a new toplevel window.  It works 
much like the "wm overrideredirect" and "wm transient" commands in
that it must be run before the window it's being applied to is mapped.

The syntax of the command is as follows:

	unsupported1 style <window> ?style?

The <window> must be a toplevel window.  If the style is not given
then the current style for the window is returned.  If you want to set
the style you must do so before the window gets mapped for the first
time.  The possible window styles include:

	documentProc, dBoxProc, plainDBox, altDBoxProc,
	movableDBoxProc, zoomDocProc, rDocProc, floatProc,
	floatZoomProc, floatSideProc, or floatSideZoomProc

NOTE: this is an unsupported command and it WILL go away in the
future.


If you have comments or Bug reports send them to:
Jim Ingham
jingham@cygnus.com

or use our on-line bug form at

http://www.scriptics.com/support/bugForm.html