[mcclim-devel] accept-values-pane

Paul Werkowski pw at snoopy.mv.com
Sun Apr 23 13:48:42 UTC 2006


Well, here it is, a user-land implementation of ACCEPT-VALUES-PANE.
CLIM programmers can use this if their implementation doesn't provide one, or
would like to customize one for some reason.

It is in package #:PAVP and the pane type and command-table is AV-PANE.

You need to load the patch-mcclim.lisp before loading avp.lisp.

Running the example code, (pavp::doit),  you will see first an application-pane
that is gratuitously needed to provide frame-standard-input. Below that are four
gadgets, but only the first toggle-button is visable (on my system at least).
The others
don't appear until the toggle-button is unchecked. This is not a clever feature
of the
example code!

Here is some info from the top of avp.lisp
;;;
;;; By Paul Werkowski, April-2006 and placed into the public domain.
;;; This code was written from the viewpoint of a CLIM user and demonstrates
;;; how ACCEPT-VALUE-PANE could (not should) be implemented. A not quite
;;; achived goal was to use only documented CLIM features.
;;; A CLIM implementer might spot some obvious problems.
;;;
;;; Just wondering how ACCEPT-VALUES-PANE can be implemented and came up
;;; with some code that should be portable across CLIM 2.0 systems
;;; (but tested only on LispWorks for Windows 4.4.6). The only non-documented
;;; exceptions is VIEW-INITARGS and FOCUS-OUT-CALLBACK below.
;;;
;;; Accept-values-pane is probably easier to implement than accepting-values
;;; because it only uses gadgets (true?), does not block, and has no exit boxes.
;;;
;;; The basics:
;;;
;;; Local things
;;;  class av-query
;;;  class av-stream
;;;  class av-pane                ]  like clim:accept-values-pane
;;;  command-table av-pane]
;;;  command com-av-update-query
;;;  event av-query-update-event
;;;
;;; CLIM things
;;; GF accept-present-default ] specialized on av-stream and views
;;; GF stream-accept              ]
;;; GF value-changed-callback]
;;;
;;; CLIM magic
;;; Gadget value-changed-callback queues an event containing query and new
;;; value. Event handler invokes presentation system to pass value to
;;; command com-update-query. Top-level-loop calls display function,
;;; stream-accept returns values found in associated query object.
;;;
;;;
;;; Results:
;;;
;;; With 'Real' CLIM:
;;; Pretty close match to clim:accept-values-pane mechanism.
;;; Noticable are:
;;;   * Some difference in font style in gadget labels.
;;;
;;;   * Slight screen flash on redisplay not noticable in CLIM version.
;;;     Some doc (LW?) says that redisplay is handled differently
;;;     for efficiency. I'd like to know how. I've seen this before when
;;;     I've used with-output-to-gadget but have not figured out the cause.
;;;
;;; With McCLIM
;;;   * Works only when FRAME-STANDARD-INPUT returns the right thing such as
;;;     when there is an application-pane or interactor-pane in the frame.
;;;     READ-COMMAND must call (ACCEPT 'COMMAND ...) as noted in the spec.
;;;     FWIW CLIM calls READ-COMMAND with STREAM parameter bound to
;;;     the frame's TOP-LEVEL-SHEET in gadget-only frame.
;;;
;;;   * CLIM ACCEPT does not pass NIL view to STREAM-ACCEPT. Instead it
;;;     passes one of +RADIO-BOX-VIEW+ +CHECK-BOX-VIEW+ or +TOGGLE-BUTTON-VIEW+,
;;;     probably by noticing GADGET-DIALOG-VIEW in STREAM-DEFAULT-VIEW.
;;;     I special case STREAM-ACCEPT to do that for McCLIM.
;;;
;;;   * Exposes problems in gadget layout, maybe do to playing poorly with
;;;     vbox-pane? Trace ALLOCATE-SPACE to see some strange stuff.
;;;

Good luck!
Paul
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-mcclim.lisp
Type: application/octet-stream
Size: 1955 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/mcclim-devel/attachments/20060423/db7ed2ad/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: avp.lisp
Type: application/octet-stream
Size: 23867 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/mcclim-devel/attachments/20060423/db7ed2ad/attachment-0001.obj>


More information about the mcclim-devel mailing list