Re: [Fxruby-users] (Non)modal dialogues.
Status: Inactive
Brought to you by:
lyle
From: Hugh S. S. E. E. <hg...@dm...> - 2003-07-18 14:51:34
|
On Fri, 18 Jul 2003, Lyle Johnson wrote: > Hugh Sasse Staff Elec Eng wrote: > > > Yes, that helps. I'm puzzled about this design though: the Dialog > > box would have to ask the application to ask the dialog box? This > > runs counter to "Tell, don't ask", IMO, if I understood that > > philosophy correctly. > > [execute] starts a modal event loop for the dialog box. The code > [is like]: > > def execute(placement=PLACEMENT_CURSOR) > create; show(placement) > getApp().runModalFor(self) > end > > [...] When you later send either the ID_ACCEPT or ID_CANCEL > [it is like] > def onCmdAccept > getApp().stopModal(self, 1) > hide > end > > So again, it is the application that keeps track of who's modal and who > isn't. OK, this fits in with "finish what you start". But since a dialog box may operate modally or nonmodally, to not make that available to themselves ... Right, I think I have managed to argue myself rount to the opposite viewpoint to which I had before: A DialogBox should never need to know if it is modal or not, because the flexible way to operate is to rely on the message target system alone. If the caller uses the return value from execute(), that is their choice. Also, it is up to the caller to hide the DialogBox if they invoked it nonmodally, because this is more in line with "tell, don't ask", the box doesn't even have to ask itself, and because nonmodal operation doesn't make it clear when the window is no longer needed. I can think of things that way round, unless that reasoning is flawed... > > Hope this helps, > Thank you, Hugh > Lyle > > |