Generic FunctionPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 9.0
This page is new in 9.0.


Arguments: window standard-object slot-name value

This generic function is called whenever a user attempts to enter a new slot value in an object-editor dialog or a class-grid widget. If it returns true then the new value is accepted, and if it returns nil then the value is rejected and the object-editor widget or the class-grid cell will continue to show the pre-edited slot value.

The default method simply returns t to allow any edit. An application could define one or more methods that override the default method to check whether the user has entered an invalid value, returning nil if so. A method could also show an error dialog explaining why the value was rejected, for example.

window will be either an object-editor dialog or the parent window that a class-grid is on. This is a suitable window to serve as the owner of an error dialog.

standard-object will be the object that is currently displayed in an object-editor dialog, or in the selected row of a class-grid widget.

slot-name will be the symbol that names the slot that is edited by the particular object-editor widget or class-grid column in which the user is currently editing a value.

value will be the newly edited value that the user is attempting to write into the slot.

Here is a simple example that allows a particular slot to contain only a string where every character is a letter. (The class does not need to be a persistent AllegroCache class, but that is typical when using an object-editor or class-grid.)

(defclass my-thing ()
  ((foo :accessor foo :initform "" :initarg :foo))

(defmethod validate-edited-slot-value
    ((window basic-pane)(my-thing my-thing)(slot-name (eql 'foo)) value)
  (cond ((and (stringp value)
              (every #'alpha-char-p value))
        (t (pop-up-message-dialog
            window "Invalid Value"
	    #.(format nil "The value of the foo slot must be ~
                           a string that contains only letters.")
            warning-icon "~OK")

Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page is new in the 9.0 release.
Created 2019.8.20.

Allegro CL version 9.0
This page is new in 9.0.