Re-using interfaces
Unable to parse email body. Email id is 7547
Unable to parse email body. Email id is 7547
Hi Edi, it could be a good idea to put a "close" button into your pane... Isn't it a little bit illogic (at least semantically) to reuse an interface already destroyed ? Why not simply keep the main layout and reuse it with a fresh interface ? For my own I never use the "make-interface" method for the reason that, in my mind, the interface-content must sometime be reusable, but the interface itself is always a one-use-only object. Maybe this feeling is wrong, but in this case I find the "destroy-interface" method's name ambigous. Cordialement Denis 2008/1/28, Edi Weitz <edi@agharta.de>: > The attached bogus test code works for me (LWW 5.0.2). Its main > purpose is to demonstrate how an interface is created and "displayed" > with state :HIDDEN, then modified, then destroyed, and then > immediately re-used by CAPI:DISPLAY-DIALOG. > > What I'd like to know is if this is permitted as a general technique > or if it will break in mysterious ways for more complicated cases. > I'm aware that probably only LispWorks can give an affirmative answer, > but maybe some of you have already tried something like this and can > comment on it. > > In case you're wondering what I need this for: The interface needs to > be an application-modal dialog eventually but between the time it is > created and its life as a dialog there are certain (a lot, actually) > things that have to be done to it some of which can only be performed > on an interface which is "displayed" (as by CAPI:DISPLAY). > > If this "re-use" approach doesn't work, I have several other > alternatives I could try, so it's not a big deal, but I'm still > curious if this is a valid usage of CAPI or totally off the mark. > > > >
On Mon, 28 Jan 2008 12:24:05 +0100, Jean Bresson <Jean.Bresson@ircam.fr> wrote: > I also thought that destroyed windows should not be displayed > anymore. It is curious that LW allows that but effectively it does > not seem to be any problem, so I wonder what destroy-interface > actually does. See the reply I just sent to Denis. I think you have to make a distinction between the CLOS objects and what they represent.
On Mon, 28 Jan 2008 09:25:13 +0100, "Denis Pousseur" <denis.pousseur@gmail.com> wrote: > it could be a good idea to put a "close" button into your pane... For what purpose? As I said, the interface is hidden. > Isn't it a little bit illogic (at least semantically) to reuse an > interface already destroyed? My understanding from the CAPI manuals (see specifically "1.3 The CAPI model" in the CAPI User Guide) is that it is /not/ illogic as the CLOS INTERFACE object is just a "proxy" to the underlying "thing" the windowing system uses. As you'll know, the CLOS object is still there even after you've destroyed an interface. You can still inspect it. My idea of how this works is that if you call CAPI:DISPLAY or CAPI:DISPLAY-INTERFACE again, a new windowing object "thing" will be created if necessary. Of course, I'm not sure if this interpretation is correct. That's why I'm asking here. > Why not simply keep the main layout and reuse it with a fresh > interface? And that isn't illogical? :) FWIW, my interface objects have lots of slots with interesting information. If I just keep the main layout, I have to copy all these slots to a new interface. > For my own I never use the "make-interface" method for the reason > that, in my mind, the interface-content must sometime be reusable, > but the interface itself is always a one-use-only object. MAKE-INTERFACE? You mean MAKE-INSTANCE? What do you use instead? > Maybe this feeling is wrong, but in this case I find the > "destroy-interface" method's name ambigous. Yes, probably.
On Mon, 28 Jan 2008 15:01:57 +0300, "Dmitriy Ivanov" <divanov@aha.ru> wrote: > Such manipulation would not be considered abnormal if > capi:interface-display were called. But in my experience, it does > not when the interface is displayed via capi:display-dialog. Yes, I also had the impression that some things are different when you use DISPLAY-DIALOG instead of DISPLAY. For example, I think there's no new thread on Windows (which makes sense) and consequently the top level hook is ignored. I wonder if that's documented somewhere and I missed it.
2008/1/28, Edi Weitz <edi@agharta.de>: > On Mon, 28 Jan 2008 09:25:13 +0100, "Denis Pousseur" <denis.pousseur@gmail.com> wrote: > > > it could be a good idea to put a "close" button into your pane... > > For what purpose? As I said, the interface is hidden. It's simply because the dialog I got with your code is modal and I didn't find a way to close it... so I had to force LW to quit. > > > Isn't it a little bit illogic (at least semantically) to reuse an > > interface already destroyed? > > My understanding from the CAPI manuals (see specifically "1.3 The CAPI > model" in the CAPI User Guide) is that it is /not/ illogic as the CLOS > INTERFACE object is just a "proxy" to the underlying "thing" the > windowing system uses. As you'll know, the CLOS object is still there > even after you've destroyed an interface. You can still inspect it. > My idea of how this works is that if you call CAPI:DISPLAY or > CAPI:DISPLAY-INTERFACE again, a new windowing object "thing" will be > created if necessary. As I said, the illogical aspect is maybe because of the name of the 'destroy-interface' method. I will read this part of the manual, thanks for the tip > > Of course, I'm not sure if this interpretation is correct. That's why > I'm asking here. > > > Why not simply keep the main layout and reuse it with a fresh > > interface? > > And that isn't illogical? > > :) > > FWIW, my interface objects have lots of slots with interesting > information. If I just keep the main layout, I have to copy all these > slots to a new interface. > > > For my own I never use the "make-interface" method for the reason > > that, in my mind, the interface-content must sometime be reusable, > > but the interface itself is always a one-use-only object. > > MAKE-INTERFACE? You mean MAKE-INSTANCE? What do you use instead? Excuse-me I was confused, I thought about 'define-interface. Starting from the point of view that a window is a non reusable object (witch is what I thought), my approach is to store interesting (and persistent) information in layout slots rather than in interface slots. Each time a window is open a method creates and displays it. This method calls another method witch (maybe) create the main-layout. For some persistent interfaces, this second method creates the layout only if it doesn't already exist : otherwise, the same layout is reused. When the interface is closed, 'change-class' is possibly used to reduce the information contained by the layout to the strict minimum (by changing his class to a mixin "pure storage" class). Because of this methodology (witch is certainly not a model, but works well for me), the definition of both interface and content in a single method is not the best way for me. But these considerations are maybe too far of the specific case you invoke. Excuse me if it's the case. Sincerely Denis > > > Maybe this feeling is wrong, but in this case I find the > > "destroy-interface" method's name ambigous. > > Yes, probably. >
On Mon, 28 Jan 2008 00:11:04 +0100, Edi Weitz <edi@agharta.de> wrote: > The attached bogus test code works for me (LWW 5.0.2). Its main > purpose is to demonstrate how an interface is created and > "displayed" with state :HIDDEN, then modified, then destroyed, and > then immediately re-used by CAPI:DISPLAY-DIALOG. Addendum, in case someone else wants to do this: This technique seems to work fine in my app so far. However, there's a subtle bug in my example code which took me some time to hunt down. /After/ the hidden interface is destroyed and /before/ it is re-displayed as a dialog, you have to set its interface state to :RESTORE. The dialog will be shown even if you don't do that, but when it is dismissed, strange things might happen. In my case, another, seemingly unrelated, dialog was also closed.