Re: [Fxruby-users] (Non)modal dialogues.
Status: Inactive
Brought to you by:
lyle
From: Lyle J. <jl...@cf...> - 2003-07-18 14:26:41
|
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. The dialog box doesn't own the information about whether it's modal or not, the application does. When you do: dialogBox.execute the application starts a modal event loop for the dialog box. The code for FXDialogBox#execute is of course implemented in C++, but if it were in Ruby it would look something like this: def execute(placement=PLACEMENT_CURSOR) create show(placement) getApp().runModalFor(self) end At this point, control returns to the event loop which is now modal for this dialog box. When you later send either the ID_ACCEPT or ID_CANCEL command message to the dialog box, this modal loop is terminated. In Ruby code, the message handlers for those would look something like: def onCmdAccept getApp().stopModal(self, 1) hide end def onCmdCancel getApp().stopModal(self, 0) hide end So again, it is the application that keeps track of who's modal and who isn't. Hope this helps, Lyle |