Allegro CL 8.0 has two new Common Graphics widgets for use in applications that use Common Graphics. (Common Graphics is only supported on Windows and Linux in release 8.0.) The widgets are the lamp widget, which is a labeled colored shape which displays different colors as it is on or off; and an HTML widget, with an associated HTML browser dialog, which allows an in-Lisp browser. In this note, we show examples using each widget and point to additional documentation.
The lamp control is a colored shape (a circle, rectangle, triangle, or diamond) which can be on or off, or can blink between on and off. The on and off colors may be any colors, and may be changed at any time. A single lamp widget can optionally display an entire rectangular array of lamp images, which may individually be on or off or blinking. This picture shows several lamp controls, illustrating different shapes and on and off color choices. Lamp controls have a title, which we use here to describe the particular lamp.
The lamp can also be blinking with a specified blink interval (we felt it was better not to show that in this article but set the value slot to :blinking and specify values for blink-off-milliseconds and blink-on-milliseconds and away you go).
If the value slot of a lamp control is a 2x2 array whose values are t, nil, or :blinking, then an array of lamps will be displayed, as in the second illustration (on color is green, off color is red, and the I in HI is blinking though we have caught it when the lamps are on). Note there is no title when the lamp value is an array:
The description of the lamp class in the documentation has more information and has links to all lamp functionality.
The html-widget is a control that renders HTML and handles clicking on links and similar browser actions. It can be used as the main pane of a web browser. The control is implemented on Windows on the WebBrowser OCX control. It is implemented on Linux on the Mozilla GTK widget. (On Windows, Allegro CL offers the ability to create other Common Graphics widgets from OCX controls -- see def-cg-ocx-control. This will be the subject of a future Tech Corner article.)
The browser has most of the standard buttons. (Unfortunately the Search button is missing: that does not seem to be part of the MS control and we are working on a way to provide a search facility.) If you want an HTML widget in your own dialog, just add it as you would any widget when designing a dialog using a form. Here is a rather rudimentary dialog with an HTML widget, an editable-text widget for entering a URL and a Go button:
Again, we try "imdb.com" and press Go and the display changes to that website:
(defun form1-button1-on-click (dialog widget) (declare (ignore-if-unused dialog widget)) (setf (value *hw*) (value *et*)) (invalidate (window *hw*)) (update-window (window *hw*)) t)
See the pages for HTML widget and HTML browser for more information and links to additional documentation. The section Release Notes for Common Graphics and the IDE in the Release Notes for more information on new features and changes in Common Graphics in Allegro CL 8.0. General documentation for Common Graphics and the IDE is described in About Common Graphics and IDE documentation in cgide.htm.
|Copyright © 2017 Franz Inc., All Rights Reserved | Privacy Statement|