A new version of Morphic was added to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.1605.mcz ==================== Summary ==================== Name: Morphic-ct.1605 Author: ct Time: 7 December 2019, 4:21:04.854219 pm UUID: 3c7d5454-0b60-2a47-91fd-51d333eeeb3b Ancestors: Morphic-mt.1604 Delete dialog windows if curtailed This can happen when the user debugs its invocation and then abandons the debugger, but also in the following example: [self inform: 'Carpe Squeak!'] valueWithin: 2 seconds onTimeout: [] Imho, it would be a bad idea to keep such a dialog window open if nothing will happen after you react on it. =============== Diff against Morphic-mt.1604 =============== Item was changed: ----- Method: DialogWindow>>debugInvocation (in category 'running') ----- debugInvocation + Processor activeProcess - [Processor activeProcess debug: self findInvocationContext + title: 'Dialog invocation'! - title: 'Dialog invocation'] - ifCurtailed: [self closeDialog].! Item was changed: ----- Method: DialogWindow>>getUserResponse (in category 'running') ----- getUserResponse | hand world | self message ifEmpty: [messageMorph delete]. "Do not waste space." self paneMorph submorphs ifEmpty: ["Do not waste space and avoid strange button-row wraps." self paneMorph delete. self buttonRowMorph wrapDirection: #none]. hand := self currentHand. world := self currentWorld. self fullBounds. self moveToPreferredPosition. self openInWorld: world. hand showTemporaryCursor: nil. "Since we are out of context, reset the cursor." hand keyboardFocus in: [:priorKeyboardFocus | hand mouseFocus in: [:priorMouseFocus | self exclusive ifTrue: [hand newMouseFocus: self]. hand newKeyboardFocus: self. + [[self isInWorld] whileTrue: [world doOneSubCycle]] + ifCurtailed: [self abandon]. - [self isInWorld] whileTrue:[world doOneSubCycle]. hand newKeyboardFocus: priorKeyboardFocus. hand newMouseFocus: priorMouseFocus]]. ^ result! |
Hi Christoph, why did you change "self closeDialog" to "self abandon"? Best, Marcel
|
Hi Marcel,
I'm not sure about this, but #closeDialog appears to perform the buttonAction on the currently selected button. #cancelDialog should match even better here. But in general, do we want so much action just in an ensure routine? If not #abandon, then I would rather call "self closeDialog: nil", and this only sets result before calling #delete.
Best, Christoph Von: Squeak-dev <[hidden email]> im Auftrag von Taeumel, Marcel
Gesendet: Sonntag, 8. Dezember 2019 15:49:10 An: John Pfersich via Squeak-dev Betreff: Re: [squeak-dev] The Inbox: Morphic-ct.1605.mcz
Hi Christoph,
why did you change "self closeDialog" to "self abandon"?
Best,
Marcel
Carpe Squeak!
|
> ... just in an ensure routine ... Hehe. Exactly. What is "ensure" in this situation? Somebody might keep a reference to that dialog, so state clean-up would be nice. "self cancelDialog" sounds good. "self closeDialog: nil" is too low-level (even private?) and that nil argument too cryptic. I also prefer #delete over #abandon. There are almost no implementors or senders of #abendon. Subclasses can easily override #delete if necessary. Best, Marcel
|
Okay. I was imagining the case that someone inherits from DialogWindow and overrides #createCancelButton or #cancelDialog to perform any excessive/interactive operation ... Von: Squeak-dev <[hidden email]> im Auftrag von Taeumel, Marcel
Gesendet: Montag, 9. Dezember 2019 10:26:46 An: John Pfersich via Squeak-dev Betreff: Re: [squeak-dev] The Inbox: Morphic-ct.1605.mcz
> ... just in an ensure routine ...
Hehe. Exactly. What is "ensure" in this situation? Somebody might keep a reference to that dialog, so state clean-up would be nice. "self
cancelDialog" sounds good. "self closeDialog: nil" is too low-level (even private?) and that nil argument too cryptic. I also prefer #delete over #abandon. There are almost no implementors or senders of #abendon. Subclasses can easily override #delete if necessary.
Best,
Marcel
Carpe Squeak!
|
I usually try to anticipate scenarios of composition instead of inheritance. Especially for those composite UI widgets. Best, Marcel
|
Free forum by Nabble | Edit this page |