home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!mintaka.lcs.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!joe
- From: joe@athena.mit.edu (Joseph C Wang)
- Newsgroups: comp.lang.tcl
- Subject: Re: tk-style interface to other windowing systems
- Message-ID: <1992Aug29.112358.11140@athena.mit.edu>
- Date: 29 Aug 92 11:23:58 GMT
- References: <1992Aug27.181758.27042@twg.com>
- Sender: news@athena.mit.edu (News system)
- Organization: Massachusetts Institute of Technology
- Lines: 55
- Nntp-Posting-Host: major.mit.edu
-
- In article <1992Aug27.181758.27042@twg.com> "David Herron" <david@twg.com> writes:
- [Possibilties for porting Tk to MS-Windows]
-
- >1) Use MS-Windows soley to provide windows & graphics primitives. This would
- >be done the same as is currently done on top of Xlib.
-
- >2) Do it as an encapsulation of MS-Windows widgets. The `button' command
- >would ultimately do whatever MS-Windows magic creates one of its button
- >widgets, for instance. MS-Windows events would be captured internally and
- >fixed up so they become appropriate TK procedure calls.
-
- >3) Create a 1-1 mapping of windows function calls and data structures to
- >commands in TCL. (Kind of like how WaFe is done). Then proceed from there
- >to somehow write an all new set of scripts for the user interface to
- >the application.
-
- I have a suggestion.......
-
- Do 1), and then write a Tk initialization file so that MS-Windows
- emulation is done in Tk instead on in C-code. The advantage is that
- you have the functionality of 2) with only the work of 1). For one
- thing, if you do things this way, you can grep the Tk code for the x
- graphics primitives, and you'll know all the places that you need to
- change.
-
- One BIG advantage in putting the Windows-like behavior in the Tk
- initialization file is that you can get Windows-like behavior on a
- unix X11 box through Tk. This means that you can test your Windows
- emulation on your sparcstation, while you are converting your C code.
-
- In short, worry only about converting the graphics primitives while
- you are converting C code. Do all your worrying about getting
- MS-Windows like behavior in Tk.
-
- Also it would be really nice if while coding your new Windows-Tk, you
- could arrange things so that all the system dependent calls are in one
- file. The Tk procedures would call procedures defined in a file
- called "windows-primitives.c." To get an X application, one would call
- procedures defined in a file "x11-primitives.c." That way, it would
- be possible for someone to port Tk be just writing a file
- "mac-primitives.c" or "os2-primitives.c" or even maybe
- "block-terminal-primitives.c"
-
- Also, if you abstract away the system dependencies, then it would be
- much, much easier to convert non-canonical Tk widgets to run in
- MS-Windows. Just use your graphics primitives instead of the X11
- ones.
-
- Whatever you do, don't do 3). It's more work for you, and if you do
- either 1 or 2 instead of 3), we'll all be able to get our Tk scripts
- running in MS-Windows. In particular, if you do 1 or 2, I'll be able
- to port my hypertext browser to MS-Windows and use Tk as a standard
- hypertext interchange language.
-
- Good luck!!!!!!!
-