Q 4.3-1) How do I provide scrollable popup menus in Allegro CLIM 2.x?
Q 4.3-2) Why do I need an XNLSPATH environment variable?
Q 4.3-3) What should I do to avoid getting palette-full error messages?
Q 4.3-4) Why can't I get the :scroll-bar option to the list-pane gadget to
work?
Q 4.3-5) Why does my 5.0 CLIM application fail to load
"sys:user32.dll"?
Q 4.3-1) How do I provide scrollable popup menus in Allegro CLIM 2.x?
A 4.3-1) Motif doesn't support scrollable popup menus. CLIM 2.2 supports :scroll-bars t but by using an old CLIM 1 presentation style menu rather than a native Motif widget based menu.
However, a better solution may be to use a a popup dialog with a scrollable list-pane. This can be done with the following code. In a real application you might want to avoid recreating a new application frame for each popup. However, this code is presented here to be as simple as possible.
(in-package :clim-user)
(define-application-frame selection-frame () ((items :initarg :items) (select-callback :initarg :select-callback)) (:panes (menu (with-slots (items select-callback) *application-frame* (make-pane 'list-pane :items items :visible-items (min 10 (length items)) :value-changed-callback select-callback)))) (:layouts (default (scrolling (:scroll-bars :dynamic) menu))) (:menu-bar nil))
(defun popup-selection-frame (items) (flet ((select-callback (gadget value) (declare (ignore gadget)) (return-from popup-selection-frame value))) (run-frame-top-level (make-application-frame 'selection-frame :items items :select-callback #'select-callback))))
Q 4.3-2) Why do I need an XNLSPATH environment variable?
A 4.3-2) In order for CLIM to work (especially when patched with ACL 4.2 patch3344, but that simply brought an existing problem to the fore), it must be able to find the xnls directory and it tries to do so via the XNLSPATH environment variable. See 3 paragraphs below for the standard location.
You need to supply an nls directory for Motif 1.2 to work properly. The problem often first shows up after loading ACL 4.2 patch3344. However, the problem is not with the patch because even without that patch there are potential problems - for example doing a cut-and-paste between Motif text-fields will cause a segmentation violation.
The error mode is unfortunate since the toolkit calls exit() directly rather than signaling an Xlib error. In post-CLIM2.0 versions CLIM will test for the Locale Database directly and will give a Lisp (hence recoverable) error message prior to startup.
If you have a standard X11R5 distribution you should find the nls directory in /usr/lib/X11 and you should set XNLSPATH to point to it. If you don't have a standard X11R5 distribution we can mail you a tar file of the directory which you should install and set XNLSPATH to point to. You can distribute the directory freely as it's part of the standard X11R5 distribution. Let us know if you would like us to send you this tar file.
Q 4.3-3) What should I do to avoid getting palette-full error messages?
A 4.3-3) CLIM's palettes are associated with X colormaps. The size of X colormaps is small, often 256 colors. To make matters worse, the default colormap is shared by all applications on your desktop. Applications such as Netscape may use up most of the colormap and leave CLIM with little to work with.
If you encounter problems, you should consider allocating your own private colormap for CLIM. CLIM allows you to create a new palette associated with a new colormap so that your application gets exclusive use of that colormap. The downside of this is that because typical display servers only have one hardware colormap, all windows of other applications will appear in "technicolor" while your CLIM app has the focus.
Here is how you change CLIM's default color palette.
(setq port (clim:find-port)) (setq framem (clim:find-frame-manager :port port)) (setq palette (clim:make-palette port)) (setf (clim:frame-manager-palette framem) palette) (setf (slot-value port 'silica::default-palette) palette)
Nevertheless, if the palette becomes full, CLIM normally does not signal an error but instead uses the "nearest" color that already exists in the colormap. It may not look quite right, but execution will continue.
This is not true for "dynamic" colors. Dynamic colors have special properties and should only be used when those special properties are required. You can change the rgb values of a dynamic color and cause all renderings of that color to change dynamically without redrawing. Attempting to allocate a dynamic color when the palette is full will signal an error because the "nearest" color will not be a dynamic color.
Q 4.3-4) Why can't I get the :scroll-bar option to the list-pane gadget to work?
A 4.3-4) The documentation is in error. The list-pane gadget class doesn't take a :scroll-bars initarg. (On the other hand the list-pane-view class does take a :scroll-bar initarg)
If you want your list-pane to have scroll-bars you should wrap it in a scroller pane. You can do this either in the panes specification or in the layout specification. e.g., using
(scrolling () (make-pane 'list-pane ...)
Moreover there is a bug in Motif 1.2.2 (but not 1.2.4, released several years ago) involving scroll-bars.
Q 4.3-5) Why does my 5.0 CLIM application fail to load "sys:user32.dll"?
A 4.3-5) Note: this problem affects CLIM on Allegro CL 5.0 only. It does not affect CLIM on Allegro CL 5.0.1.
There is a bug in 5.0 CLIM that incorrectly causes user32.dll, a Microsoft Windows dll needed by CLIM during application initialization, to be loaded from the wrong place.
The fix is to insert the following in your application
(let ((shlib
(find-if #'(lambda (item)
(equalp "user32.dll" (file-namestring (excl::shlib-name item))))
excl::.loaded-shared-libraries.)))
(setf (excl::shlib-prelinked shlib) t))
immediately after you require CLIM, which is (presumably) done with a form like:
(require :climnt)
The problem should then go away.
Again, this workaround is not needed in Allegro CL 5.0.1.
© Copyright 1999, Franz Inc., Berkeley, CA. All rights reserved.
$Revision: 1.1.2.11 $