How do take action before a morph closes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How do take action before a morph closes

Schwab,Wilhelm K
Gary, all,

My Polymorph-based image mask editing gizmo is taking shape.  I easily set up a column of buttons to clear, save and toggle display of the mask.  I had a pretty rough time making the toggle *work* but that was a logic error on my part.  Next, I need to detect that a mask has been saved and apply it to a newly loaded image; I think I see how to do that.  

Another important feature would be to automatically save the mask rather than expecting the user to do that explicitly.  How can I detect that the morph/panel is about to close and execute a command?  If I wanted to do so, how could I detect that the mask has not been saved, and warn the user and/or veto closing the morph?  For now I would be happy to just save the mask, but stopping something from closing will eventually arise.

Bill



_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: How do take action before a morph closes

Henrik Sperre Johansen

On Aug 13, 2010, at 4:01 57AM, Schwab,Wilhelm K wrote:

>
> Another important feature would be to automatically save the mask rather than expecting the user to do that explicitly.  How can I detect that the morph/panel is about to close and execute a command?  If I wanted to do so, how could I detect that the mask has not been saved, and warn the user and/or veto closing the morph?  For now I would be happy to just save the mask, but stopping something from closing will eventually arise.
>
> Bill

Take a look at SystemWindow >> delete, there are plenty of hooks.
Implementing #okToClose  on your windows' model in terms of checking for/ saving changes to the mask would probably be what you want.
As for detecting changes, if all masks are in the same format, and you don't plan on doing this for masks > 2000@2000 interactively, a simple "aForm bits = anotherForm bits" would probably perfom well enough.
_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project