Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!sun-barr!decwrl!ucbvax!hplabs!hplabsz!mayer From: mayer@hplabsz.HPL.HP.COM (Niels Mayer) Newsgroups: comp.windows.news Subject: Re: Toolkits, toolkits, toolkits ... Message-ID: <4572@hplabsz.HPL.HP.COM> Date: 3 Jan 90 21:39:30 GMT References: <7391@ficc.uu.net> <634@s5.Morgan.COM> Reply-To: mayer@hplabs.hp.com (Niels Mayer) Organization: Hewlett-Packard Labs, Software Technology Lab, Palo Alto, CA. Lines: 72 Summary: Expires: Sender: Followup-To: In article <634@s5.Morgan.COM> jordan@Morgan.COM (Jordan Hayes) writes: > But first make the easy things easy. "Hello World" in a > windowing system shouldn't be more than 10 lines of code. >Sigh. When will people learn to code before blabing on USENET? >This is in Motif ... > >== not 10 lines but the meat is only 8 lines ... === > Well, you can easily do a "hello world" in WINTERP in less than 10 lines. WINTERP is an interpretive environment for rapid prototyping applications using the Motif UI toolkit. It is based on the mini-lisp interpreter XLISP and makes extensive use of XLISP's object system as the application programmers interface to Motif. It is available for free on the X11r4 tape or via anonymous ftp from expo.lcs.mit.edu:contrib/winterp.tar.Z. You might think of WINTERP as client-side NeWS without the imaging model (??). Or you might think of WINTERP as a gnuemacs-like prototyping environment that uses widgets as it's primary UI interactor rather than textual buffers.... ---------- The following is an excerpt from a previous posting to comp.windows.x containing a 9 line hello world: ... WINTERP makes extensive use of XLISP's Smalltalk-like extensions for object oriented programming: All the Motif widget classes are actually implemented as XLISP classes, Xtoolkit functions become methods on the widget base class. Motif "Convenience Functions" become methods on particular classes. Because Motif Classes look like normal XLISP classes inside WINTERP, you may extend the functionality of existing widget classes in Lisp via subclassing, or by adding new methods to existing widget classes. Example -- evaluating the following form in WINTERP results in the display of a "hello world" window which sends me mail and prints "hello world" on stdout each time the button is clicked: (let* ((top_w (send TOP_LEVEL_SHELL_WIDGET_CLASS :new :XMN_TITLE "hello world" ;note auto string->XmString conv :XMN_ICON_NAME "hello world")) ;ditto (but_w (send XM_PUSH_BUTTON_WIDGET_CLASS :new :managed top_w :XMN_FONT_LIST "8x16"))) ;note auto string->FontList cv (send but_w :add_callback :XMN_ARM_CALLBACK '() '((system "echo \"Hello World Run!\" | mailx mayer@hplabs.hp.com") (format t "hello world\n"))) (send top_w :realize)) Once the "hello world" window is displayed, you can interactively modify the look and the functionality of the interface. For example, lets say I want to change the color of a widget on the display -- I give WINTERP the following command: (send (get_moused_widget) :set_values :XMN_FOREGROUND "white" :XMN_BACKGROUND "blue") and then click on the pushbutton widget created above. One can use the same technique to interactively change a widget's callbacks, eventhandlers, etc. For further information, take a look at the WINTERP source distribution's "examples" directory. Interesting mini-applications include a bitmap browser, a MH-based mail browser, and a grep-based file search browser. Other examples show you how to contruct menus, radio-boxes, etc. ... ------------------------------------------------------------------------------- Niels Mayer -- hplabs!mayer -- mayer@hplabs.hp.com Human-Computer Interaction Department Hewlett-Packard Laboratories Palo Alto, CA. *