Generic FunctionPackage: ideToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.0
Unrevised from 9.0 to 10.0.
9.0 version

sample-initargs

Arguments: dialog-item

This generic function is called when a widget is being placed onto a form window, to determine the sample property values that it will initially have. Widgets do not have these sample property values when created programmaticlly; they are added only when designing dialogs interactively as forms to illustrate typical property values and their effects.

An :around method prevents sample initargs from being used when the name of the widget class is not in a built-in CG package. This prevents overriding the default initargs of a user widget subclass that has been placed onto the widget palette with a call to add-to-component-toolbar. That method has made it only marginally useful to define custom sample-initargs methods. But you could redefine the sample properties for built-in widget classes if desired. Or if it's tedious to remove the sample property values after creating instances of the built-in widget classes, you could define methods for built-in classes that simply return nil to avoid sample property values altogether.

A sample-initargs method should accept a single argument, which is a widget that's being added to a form. It should return a plist that's similar to the :default-initargs plist of a defclass form.

Here is the built-in method for single-item-list, which provides a sample range and initial value:

(defmethod sample-initargs ((widget single-item-list))
  (list :range (list :one :two :three)
        :value :one))

Custom sample-initargs methods should not be added to project code, because they are part of the IDE, which is not present in standalone applications. Custom methods could be loaded automaticatlly whenever the IDE starts up by placing the code into a startup.cl file in your main Allegro directory. Just create that file if it doesn't exist already.


Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 9.0 page.
Created 2015.5.21.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.0
Unrevised from 9.0 to 10.0.
9.0 version