Re: capi:interface-display for dialogs
Martin Simmons <[email protected]>
| Newsgroups | gmane.lisp.lispworks.general |
|---|---|
| Message-ID | <[email protected]> |
>>>>> On Fri, 4 Apr 2025 18:32:53 +0200, Erik Ronström (as erik dot ronstrom at doremir dot com) said: > > This has always bugged me as well. > > > > Sometimes initialization code can be put in the create-callback of your interface, though adding it in suitable methods for initialize-instance or interface-display is usually better. > > I’ve always wondered in what way it is ”better”. The documentation for interface also says: > > > Note: create-callback should be used only for operations that must be done with the interface already created and cannot be done in interface-display. Otherwise they should be either done in initialize-instance or between your calls to make-instance and display. An operation that needs to run after the interface is created but just before displaying the interface as an ordinary window (typical cases are font queries and loading images) can be put in the interface-display :before method. An operation that needs to run just after displaying the interface as an ordinary window can be put in the interface-display :after method. > > > Again, I find it unclear WHY create-callback should be avoided – what are > the dangers or drawbacks with the callback that makes it a last resort? It was mainly because customers were misusing create-callback for the things that we now list as "Otherwise they should be either done..." above. The name is also somewhat misleading, because it is not creation in the normal sense of the word, it is prepare-for-display-callback. Since capi:interface is almost always subclassed, adding methods on interface-display just as easy as using create-callback. -- Martin Simmons LispWorks Ltd http://www.lispworks.com/ _______________________________________________ Lisp Hug - the mailing list for LispWorks users [email protected] http://www.lispworks.com/support/lisp-hug.html