[racket] Racket GUI and Sound Infelicities

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Aug 9 12:18:23 EDT 2012

Thanks for the feedback!


Although `racket/gui' provides `play-sound' out of the box, we should
take another look at modern options for sound support. I'll try to do
that sometime soon, starting with the Planet packages that you mention.


I'd like to improve `racket/gui', but given other constraints, this
particular direction has a lower priority than others.

If anyone is willing to tackle these problems, I'd be happy to provide
further advice. I would also be willing to work more on, say, the Gtk
back end for `racket/gui', which could be made more reusable for a new
Gtk binding, which in turn could provide access to a modern (if less
platform-native) selection of widgets. Or I would be happy to add new
hooks like `get-handle' and `get-client-handle' in `window<%>' if that
helps for implementing new widgets.

At Wed, 8 Aug 2012 22:17:58 -0400, Assertion Violation wrote:
> I've been very pleased with Racket as a programming language, and I quite like 
> the DrRacket environment (especially its debuggers).  However, there are some 
> serious problems with I/O.  It's more difficult to repair these from a 'user' 
> (programmer) standpoint than other problems, because fixing them would require 
> writing code for each platform Racket runs on, and most programmers won't have 
> access to all those platforms.
> The GUI toolkit lacks some common, important, functionality and widgets.  The 
> two biggest issues are:
> * inability to drag and drop across widgets
> * inability to read theme information (like the color for selected/unselected 
> title bars)
> Since you can write your own widgets in Racket, if those were repaired, it 
> would be possible to implement the missing functionality and widgets from 
> within Racket.  However, I am told there is great concern for making the GUI's 
> look and behave like 'native' ones.  If that is so, then someone with access to 
> all the platforms Racket runs on will need to provide access to native 
> equivalents.
> Missing functionality and widgets include:
> * the tree view doesn't allow editing entries by double clicking or dropping 
> items onto it, as far as I can tell; this is necessary for file managers and 
> some other GUI's
> * you can't associate icons with entries in pulldown menus, context menus, list 
> views, or tree views
> * there is no icon view, nor any way to use the table view as a icon view 
> (occasionally done in other toolkits) - this is necessary for file managers, 
> image viewers, and some other GUI's
> * the table view is primitive - other table implementations support rearranging 
> rows and columns by dragging the headers, selecting/deselecting the table by 
> clicking the upper left corner (where row and column headers meet), 
> selecting/deselecting entire rows or columns by single-clicking the headers, 
> sorting the table by double-clicking the headers, dragging to select a 
> rectangle of cells, holding Ctrl to add/remove from a selection, and embedding 
> checkboxes, listboxes, and spinboxes or associating validators with columns
> * there is no toolbar widget - toolbar widgets usually automatically handle 
> arranging their buttons along the top, bottom, left, or right sides of the main 
> window, below the pulldown menus if those are present
> * there is no infobar widget - these are a alternative to dialogs when its okay 
> if the user proceeds without responding, they're widely used in web browsers, 
> and usually appear below the pulldown menus or toolbar if those things are 
> present
> * there is no status bar widget - status bars are usually fixed to the bottom 
> of the main window, and are divided horizontally into sections that are always 
> displayed, while others may be 'overwritten' by temporary messages
> * there is no tooltip widget - applications that use them (like DrRacket) 
> currently roll their own, which means they /don't/ look native
> * there is no spinbox widget (sometimes called a spinner, though "spinner" can 
> also refer to a display showing a process is 'busy') - this is a integer or 
> floating point display that you can type numbers into, or click the 
> corresponding up/down arrows that appear next to them to raise or lower the 
> number; the default value, the range, the step size of the arrow buttons, the 
> precision when displaying floating point, and optional text to the left or 
> right (usually a monetary or percentage symbol) should be configurable; these 
> widgets may also support strings where there is some inherent order, such as 
> days of the week, though a combo box could be argued to be a better choice
> * there is no toolbox widget (sometimes called a accordion widget) - these 
> appear as a vertical series of undecorated window title bars, the top one of 
> which will be open initially exposing its contents, and when you click another 
> title bar the one that was open will close (only showing its title bar) and the 
> contents associated with the title bar you clicked will open; see 
> http://doc.qt.nokia.com/4.7-snapshot/images/designer-containers-toolbox.png ; 
> these widgets are very useful for GUI builders, graphics editors, and similar 
> tools
> * there is no grid layout, though there is one on PLaneT 
> http://planet.racket-lang.org/display.ss?package=table-panel.plt&owner=williams
> * there is no window docking support
> * there is no Multiple Document Interface (MDI) support
> * there is no convenient way to save/restore window layout
> I've tried to use the standard terminology so anyone unfamiliar with these 
> things could look them up on sites like Wikipedia.  There are some curious 
> naming decisions where Racket's widgets are concerned (e.g. I would have never 
> looked for "gauge" when I needed a "progress bar").  Hopefully I haven't 
> created more confusion in the process.
> Out of the box, Racket lacks any way to output sounds.  I find this a strange 
> omission.  Even the most boring business application will occasionally need to 
> play sounds to notify the user of something.  PLaneT does have PortAudio and 
> RSound, which appear to almost solve the problem.  Most sound file formats 
> aren't supported, but I suppose support for that could be written in portable 
> Racket.  Perhaps at least PortAudio and RSound should be integrated officially, 
> lest they go unsupported in the future.
> While it may seem like I'm doing nothing but heaping criticism on Racket, 
> that's not my intent.  I like Racket a lot, and would prefer to use it for most 
> things, but the limited support for I/O has driven me to experiment with 
> Clojure and Swing with Java Sound.
>  		 	   		  ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.