From: uncutstone wu Date: 2006-05-18T02:25:53+09:00 Subject: Re: Need help designing UI Ryan Leavengood wrote: > Essentially all communication between various parts of the system > (from the OS to applications and back, from applications to their > windows and back, from windows to the GUI components and back) is done > via messages. A looper class is used to loop over messages coming in > and then the handling of these messages are delegated to a handler > class. On BeOS frequently the looper and handler are the same class. > > Messages are handled first by their direct recipient (for example a > mouse down would be handled first by the component being clicked on.) > If the message cannot be handled by that recipient, it is passed up > the inheritance hierarchy until it is handled. Usually messages that > are used within an application itself are targeted directly to the > window, and then the window can delegate to the appropriate component. > > So for you example, the "Close Window" toolbar button would have a > message with an associated CLOSE command constant, with the target of > the message being the window. When the button is clicked, the CLOSE > message will be sent to the window and the handling of that message > will close the window (of course.) The nice thing about this is that > the CLOSE message could be used from other places without having to > change how it is handled within the window. > > Ryan I think there are two essential design patterns here, one is message dispatcher, and the other is chain of responsibility . -- Posted via http://www.ruby-forum.com/.