Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!unido!tub!net From: net@tub.UUCP (Oliver Laumann) Newsgroups: comp.windows.news Subject: Re: Toolkits, toolkits, toolkits ... Message-ID: <1132@tub.UUCP> Date: 4 Jan 90 15:05:32 GMT References: <7391@ficc.uu.net> <634@s5.Morgan.COM> <4572@hplabsz.HPL.HP.COM> Reply-To: net@tub.UUCP (Oliver Laumann) Organization: Technical University of Berlin, Germany Lines: 58 In article <4572@hplabsz.HPL.HP.COM> mayer@hplabs.hp.com (Niels Mayer) writes: > 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 ... > > Well, you can easily do a "hello world" in WINTERP in less than 10 lines. [Example program and WINTERP blurb deleted] This is how you would write it in `Elk' Scheme: ;;; -*-Scheme-*- (require 'xwidgets) (load-widgets shell label) (let* ((con (create-context)) (dpy (initialize-display con 'kraftbus:0 'hello 'demo)) (top (create-shell 'hello 'demo (find-class 'application-shell) dpy)) (w (create-managed-widget (find-class 'label) top 'label "Hello world"))) (realize-widget top) (context-main-loop con)) Note that the initialization of the application context and display is somewhat lengthy (by the way, I wonder why the initialization is missing in the WINTERP example). `kraftbus' is the name of the workstation on my desk (yes, the name is weird, if you want me to tell you the anecdote behind it, drop me a letter), so `kraftbus:0' obviously is the display name. One can use #f instead to indicate that the value of the $DISPLAY environment variable is to be used. The `require' form loads the Elk interface to the Xlib, Xt, and the Athena widget set (one would write "(require 'motif)" to load the interface to the OSF/Motif widgets). `find-class' creates a Scheme object of type `widget class' (widget classes are, like widgets and application contexts, first class objects). If the example had used the Athena command widget, one could have added a callback like this: (add-callback w 'callback (lambda (widget) ; do something )) or, using set-values!, (set-values! w 'callback (list (lambda (widget) ...))) -- Oliver Laumann net@TUB.BITNET net@tub.UUCP