1 |
578 |
markom |
Tk 8.0.4 for Macintosh
|
2 |
|
|
|
3 |
|
|
by Ray Johnson
|
4 |
|
|
Scriptics Corporation
|
5 |
|
|
rjohnson@scriptics.com
|
6 |
|
|
with major help from
|
7 |
|
|
Jim Ingham
|
8 |
|
|
Cygnus Solutions
|
9 |
|
|
jingham@cygnus.com
|
10 |
|
|
|
11 |
|
|
RCS: @(#) $Id: README,v 1.1.1.1 2002-01-16 10:25:55 markom Exp $
|
12 |
|
|
|
13 |
|
|
1. Introduction
|
14 |
|
|
---------------
|
15 |
|
|
|
16 |
|
|
This is the README file for the Macintosh version of the Tk
|
17 |
|
|
extension for the Tcl scripting language. The file consists of
|
18 |
|
|
information specific to the Macintosh version of Tcl and Tk. For more
|
19 |
|
|
general information please read the README file in the main Tk
|
20 |
|
|
directory.
|
21 |
|
|
|
22 |
|
|
2. What's new?
|
23 |
|
|
-------------
|
24 |
|
|
|
25 |
|
|
Native Look & Feel!!! We now try really hard to support the
|
26 |
|
|
Macintosh Look & Feel with Tcl/Tk 8.0. We aren't finished but
|
27 |
|
|
it look pretty good. Let me know what are the most "un-mac like"
|
28 |
|
|
problems and I'll fix them as quickly as I can.
|
29 |
|
|
|
30 |
|
|
The button, checkbutton, radiobutton, and scrollbar widgets actually
|
31 |
|
|
use the Mac toolbox controls. This means that they will track the
|
32 |
|
|
look&feel if you use extension that change the appearance of
|
33 |
|
|
applications (like Aaron.) We also use "system" colors so the default
|
34 |
|
|
backgrounds etc. will also change colors. We plan to support this
|
35 |
|
|
feature - so let me know if something doesn't work quite right.
|
36 |
|
|
Unfortunantly, we are not able to change the colors of buttons under
|
37 |
|
|
MacOS 8. Doing this is discouraged under Appearance, and we will probably
|
38 |
|
|
not implement it anytime soon.
|
39 |
|
|
|
40 |
|
|
We also now support native menus! By using the new -menu option
|
41 |
|
|
on toplevels you can have a menubar that is cross platform. You
|
42 |
|
|
can also place Tk menus in the Apple and Help menus! Check out
|
43 |
|
|
the documentation for more details. Syd Polk is
|
44 |
|
|
the author of the new menu code. Feel free to contact him if you
|
45 |
|
|
have questions or comments about the menu mechanism.
|
46 |
|
|
|
47 |
|
|
As of Tk 8.0.4, MacTk menus will adopt the backgrounds, shape, separator, etc
|
48 |
|
|
of the current theme.
|
49 |
|
|
|
50 |
|
|
The "tk_messageBox" command on the Macintosh is now much more
|
51 |
|
|
mac-like. I'll probably still need to adjust this more - but it
|
52 |
|
|
looks a hell of alot better than it did before.
|
53 |
|
|
|
54 |
|
|
I've also added a command that allows you to get more native window
|
55 |
|
|
styles. However, we have yet to decide on a cross platform solution
|
56 |
|
|
to the problem of varying window styles. None the less, I thought
|
57 |
|
|
it would be use full to add the capability in an unsupported means
|
58 |
|
|
to tide you over until a better solution is available. The command
|
59 |
|
|
is called "unsupported1". It can be used in the following way:
|
60 |
|
|
|
61 |
|
|
toplevel .foo; unsupported1 style .foo zoomDocProc
|
62 |
|
|
|
63 |
|
|
The above command will create a document window with a zoom box.
|
64 |
|
|
Type "unsupported1 style . ???" to get a list of the supported
|
65 |
|
|
styles. The command works like "wm overrideredirect" - you must
|
66 |
|
|
make the call before the window is mapped.
|
67 |
|
|
|
68 |
|
|
As always - report the bugs you find - including asthetic ones
|
69 |
|
|
in the look & feel of widgets.
|
70 |
|
|
|
71 |
|
|
3. Mac specific features
|
72 |
|
|
------------------------
|
73 |
|
|
|
74 |
|
|
There are several features or enhancements in Tk that are unique to
|
75 |
|
|
the Macintosh version of Tk. Here is a list of those features and
|
76 |
|
|
pointers to where you can find more information about the feature.
|
77 |
|
|
|
78 |
|
|
* The menu command has special rules for accessing the Macintosh
|
79 |
|
|
Apple and Help menus. See the menu.m man page for details.
|
80 |
|
|
|
81 |
|
|
* If you have the special Tcl function "tkAboutDialog" defined, it
|
82 |
|
|
will be called instead of displaying the default About Box in the
|
83 |
|
|
console or other parts of the Wish application. See below for
|
84 |
|
|
details.
|
85 |
|
|
|
86 |
|
|
* In addition to the standard X cursors, the Mac version of Tk will
|
87 |
|
|
let you use any Mac cursor that is named and installed in your
|
88 |
|
|
application. See the GetCursor.3 man page for details.
|
89 |
|
|
|
90 |
|
|
* The wish application has a couple of hooks to know about the exit,
|
91 |
|
|
"open document" and "Do Script" Mac High Level events.
|
92 |
|
|
See below for details.
|
93 |
|
|
|
94 |
|
|
* The command unsupported1 will allow you to set the style of new
|
95 |
|
|
toplevel windows on the Macintosh. It is not really supported.
|
96 |
|
|
See below for details.
|
97 |
|
|
|
98 |
|
|
* In addition to the standard built-in bitmaps that Tk supports, the
|
99 |
|
|
Mac version of Tk allows you to use several Mac specific icons. See
|
100 |
|
|
the GetBitmap.3 man page for a complete list.
|
101 |
|
|
|
102 |
|
|
* The send command does not yet work on the Macintosh. We hope to
|
103 |
|
|
have it available in Tk 8.1.
|
104 |
|
|
|
105 |
|
|
* The -use and -container options almost work. The focus bugs that
|
106 |
|
|
were in Tk8.0 final have been fixed. But there are still some
|
107 |
|
|
known bugs that cause some major problems. Be careful, if you
|
108 |
|
|
decide to use these features. (See bugs.doc for details.)
|
109 |
|
|
|
110 |
|
|
4. The Distribution
|
111 |
|
|
-------------------
|
112 |
|
|
|
113 |
|
|
Macintosh Tk is distributed in three different forms. This
|
114 |
|
|
should make it easier to only download what you need. The
|
115 |
|
|
packages are as follows:
|
116 |
|
|
|
117 |
|
|
mactk8.0.4.sea.hqx
|
118 |
|
|
|
119 |
|
|
This distribution is a "binary" only release. It contains an
|
120 |
|
|
installer program that will install a 68k, PowerPC, or Fat
|
121 |
|
|
version of the "Wish" application. In addition, in installs
|
122 |
|
|
the Tcl & Tk libraries in the Extensions folder inside your
|
123 |
|
|
System Folder. (No "INIT"'s or Control Pannels are installed.)
|
124 |
|
|
|
125 |
|
|
mactcltk-full-8.0.4.sea.hqx
|
126 |
|
|
|
127 |
|
|
This release contains the full release of Tcl and Tk for the
|
128 |
|
|
Macintosh plus the More Files package on which Macintosh Tcl and
|
129 |
|
|
Tk rely.
|
130 |
|
|
|
131 |
|
|
mactk-source-8.0.4.sea.hqx
|
132 |
|
|
|
133 |
|
|
This release contains the complete source to Tk for the Macintosh
|
134 |
|
|
In addition, Metrowerks CodeWarrior libraries and project files
|
135 |
|
|
are included. However, you must already have the More Files
|
136 |
|
|
package to compile this code.
|
137 |
|
|
|
138 |
|
|
5. Documentation
|
139 |
|
|
----------------
|
140 |
|
|
|
141 |
|
|
There are now many books available for Tcl. These two provide a good
|
142 |
|
|
introduction to the language. It is a good way to get started
|
143 |
|
|
if you haven't used the language before:
|
144 |
|
|
|
145 |
|
|
Title: Tcl and the Tk Toolkit
|
146 |
|
|
Author: John K. Ousterhout
|
147 |
|
|
Publisher: Addison-Wesley
|
148 |
|
|
ISBN: 0-201-63337-X
|
149 |
|
|
|
150 |
|
|
Title: Practical Programming in Tcl and Tk
|
151 |
|
|
Author: Brent Welch
|
152 |
|
|
Publisher: Prentice Hall
|
153 |
|
|
ISBN: 0-13-182007-9
|
154 |
|
|
|
155 |
|
|
More books are listed at
|
156 |
|
|
http://www.scriptics.com/resource/doc/books/
|
157 |
|
|
|
158 |
|
|
The "doc" subdirectory contains reference in documentation
|
159 |
|
|
in the "man" format found on most UNIX machines. Unfortunately,
|
160 |
|
|
there is not a suitable way to view these pages on the Macintosh.
|
161 |
|
|
A version suitable for viewing on the Macintosh has yet to be
|
162 |
|
|
developed. We are working are having better documentation for
|
163 |
|
|
the Macintosh platform in the future. However, if you have WWW
|
164 |
|
|
access you may access the Man pages at the following URL:
|
165 |
|
|
|
166 |
|
|
http://www.scriptics.com/man/tcl8.0/contents.html
|
167 |
|
|
|
168 |
|
|
Other documentation and sample Tcl scripts can be found at
|
169 |
|
|
the Tcl ftp site:
|
170 |
|
|
|
171 |
|
|
ftp://ftp.neosoft.com/tcl/
|
172 |
|
|
|
173 |
|
|
The internet news group comp.lang.tcl is also a valuable
|
174 |
|
|
source of information about Tcl. A mailing list is also
|
175 |
|
|
available (see below).
|
176 |
|
|
|
177 |
|
|
6. Compiling Tk
|
178 |
|
|
---------------
|
179 |
|
|
|
180 |
|
|
In order to compile Macintosh Tk you must have the
|
181 |
|
|
following items:
|
182 |
|
|
|
183 |
|
|
CodeWarrior Pro 1 or higher (CodeWarrior release 9 or higher can work
|
184 |
|
|
and we have project files, but we are depricating support)
|
185 |
|
|
8.0.4 was build with CW Pro 3.
|
186 |
|
|
Mac Tcl 8.0 (source)
|
187 |
|
|
(which requires More Files 1.4.2 or 1.4.3)
|
188 |
|
|
Mac Tk 8.0 (source)
|
189 |
|
|
|
190 |
|
|
The project files included with the Mac Tcl source should work
|
191 |
|
|
fine. The only thing you may need to update are the access paths.
|
192 |
|
|
As with Tcl, there is something in the initial release of the CW Pro 2
|
193 |
|
|
linker that rendersthe CFM68K version of Wish very unstable. I am
|
194 |
|
|
working with Metrowerks to resolve the issue.
|
195 |
|
|
|
196 |
|
|
Special notes:
|
197 |
|
|
|
198 |
|
|
* Check out the file bugs.doc for information about known bugs.
|
199 |
|
|
|
200 |
|
|
* We are starting to support the new Appearance Manager that shipped
|
201 |
|
|
with MacOS 8.0. The Tk 8.0.3 release is the first Tk release
|
202 |
|
|
that supports the Appearance Manager well. Tk 8.0.4 extends this support
|
203 |
|
|
to the menu system, though you have to have Appearance 1.0.1 or later
|
204 |
|
|
installed for this to work.
|
205 |
|
|
|
206 |
|
|
* If you get the Unix tar file, it will untar into a directory tcl8.0.4. However,
|
207 |
|
|
the Macintosh project files expect the folder to be called tcl8.0. You will need
|
208 |
|
|
to rename the folder to tcl8.0, or change all the paths in the project files.
|
209 |
|
|
|
210 |
|
|
|
211 |
|
|
7. About Dialog
|
212 |
|
|
---------------
|
213 |
|
|
|
214 |
|
|
There is now a way to replace the default dialog box for the Wish
|
215 |
|
|
application. If you create the tcl procedure "tkAboutDialog" it will
|
216 |
|
|
be called instead of creating the default dialog box. Your procedure
|
217 |
|
|
is then responsible for displaying a window, removing it, etc. This
|
218 |
|
|
interface is experimental and may change in the future - tell me what
|
219 |
|
|
you think of it.
|
220 |
|
|
|
221 |
|
|
8. Apple Events
|
222 |
|
|
---------------
|
223 |
|
|
|
224 |
|
|
Tcl/Tk currently doesn't have much in the way of support for Mac
|
225 |
|
|
Apple Events. There is no way to send an apple event (although you
|
226 |
|
|
could write an extension to do this) and no general purpose way to
|
227 |
|
|
recieve apple events. However, there are a couple of hooks for
|
228 |
|
|
dealing with some of the standard apple events.
|
229 |
|
|
|
230 |
|
|
exit - Generally, Tcl cleans up after it self when you exit.
|
231 |
|
|
However, your application may want to do application specifc
|
232 |
|
|
cleanup like saving a users data. To do this you can rename
|
233 |
|
|
the exit command to something else. Define your own exit
|
234 |
|
|
command to do whatever clean up you like and then call the
|
235 |
|
|
origional exit command. For example,
|
236 |
|
|
|
237 |
|
|
rename exit __exit
|
238 |
|
|
proc exit {} {
|
239 |
|
|
# Do your clean up hear
|
240 |
|
|
__exit
|
241 |
|
|
}
|
242 |
|
|
|
243 |
|
|
Both incoming quit events and hitting the Quit menu item
|
244 |
|
|
will call the exit command. However, don't expect you can
|
245 |
|
|
abort the exit. Tk may exit anyway if the exit command it
|
246 |
|
|
calls does not actually quit the application.
|
247 |
|
|
|
248 |
|
|
open - The other apple event Tk supports is the open event. The
|
249 |
|
|
open event is sent to Tk if, for example, you drop a file on
|
250 |
|
|
the Wish icon. If you define a Tcl procedure with the name
|
251 |
|
|
"tkOpenDocument" it will be invoked on any Open Document
|
252 |
|
|
events that the application receives. The a list of paths to
|
253 |
|
|
the various documents will be passed to the Tcl function.
|
254 |
|
|
Here is an example,
|
255 |
|
|
|
256 |
|
|
proc tkOpenDocument args {
|
257 |
|
|
foreach file $args {
|
258 |
|
|
# Deal with passed in file path
|
259 |
|
|
}
|
260 |
|
|
}
|
261 |
|
|
|
262 |
|
|
Note: This isn't every thing you need to do to make your
|
263 |
|
|
application dropable. You must still define a FREF resource
|
264 |
|
|
that makes sense for your application domain. (Out of the
|
265 |
|
|
box, you will not be able to drop files on the Wish
|
266 |
|
|
application. See the Inside Macintosh documentation for
|
267 |
|
|
details about the FREF resource.
|
268 |
|
|
|
269 |
|
|
do script - This is a way for external applications to drive MacTk, or
|
270 |
|
|
to recieve information from it. From AppleScript, you can say:
|
271 |
|
|
|
272 |
|
|
tell application "Wish8.0"
|
273 |
|
|
do script "console hide
|
274 |
|
|
pack [button .b1 -text {Hello world} -command exit]"
|
275 |
|
|
end tell
|
276 |
|
|
|
277 |
|
|
which will get Tk to run the canonical hello world application.
|
278 |
|
|
|
279 |
|
|
8. unsupported1
|
280 |
|
|
---------------
|
281 |
|
|
|
282 |
|
|
The unsupported1 command is a short term hack we made available to
|
283 |
|
|
allow you to set the window style of a new toplevel window. It works
|
284 |
|
|
much like the "wm overrideredirect" and "wm transient" commands in
|
285 |
|
|
that it must be run before the window it's being applied to is mapped.
|
286 |
|
|
|
287 |
|
|
The syntax of the command is as follows:
|
288 |
|
|
|
289 |
|
|
unsupported1 style ?style?
|
290 |
|
|
|
291 |
|
|
The must be a toplevel window. If the style is not given
|
292 |
|
|
then the current style for the window is returned. If you want to set
|
293 |
|
|
the style you must do so before the window gets mapped for the first
|
294 |
|
|
time. The possible window styles include:
|
295 |
|
|
|
296 |
|
|
documentProc, dBoxProc, plainDBox, altDBoxProc,
|
297 |
|
|
movableDBoxProc, zoomDocProc, rDocProc, floatProc,
|
298 |
|
|
floatZoomProc, floatSideProc, or floatSideZoomProc
|
299 |
|
|
|
300 |
|
|
NOTE: this is an unsupported command and it WILL go away in the
|
301 |
|
|
future.
|
302 |
|
|
|
303 |
|
|
|
304 |
|
|
If you have comments or Bug reports send them to:
|
305 |
|
|
Jim Ingham
|
306 |
|
|
jingham@cygnus.com
|