Hi,
I'm trying to figure out how the Dolphin Views receive event messages from windows. As far as I understand message are sent straight to the immediate receiver and not passed down the hierarchy of the views. Any help appreciated Günther |
Günther,
> I'm trying to figure out how the Dolphin Views receive event messages > from windows. > > As far as I understand message are sent straight to the immediate > receiver and not passed down the hierarchy of the views. > > Any help appreciated You might give this a try: http://www.object-arts.co.uk/wiki/html/Dolphin/AddingNewWindowsMessages.htm The messages are identified by window handle (which Dolphin maps to the receiver to send a message to the correct object), a message ID of some sort (which Dolphin maps to the selector) and some additional parameters that are shoehorned into a couple of numbers. Perhaps the best description I have ever seen of the variations appears in Borland's [*] Open Architecture Guide, in the section on Object Windows. [*] AFAICT, it was the Whitewater folks who were the true brains behind it. Have a good one, Bill -- Wilhelm K. Schwab, Ph.D. [hidden email] |
In reply to this post by Günther Schmidt
Günther,
> I'm trying to figure out how the Dolphin Views receive event messages > from windows. You might find it helpful to read the MS description of the fundamentals of the Windows message system (you'll have to reassemble the URL) http://msdn.microsoft.com/library/en-us/winui/winui/ windowsuserinterface/windowing/messagesandmessagequeues/ aboutmessagesandmessagequeues.asp When you read that bear in mind that, Dolphin is from Windows' POV, a single-threaded application, meaning that it has a single message loop that handles all its windows. The main message loop itself is provided by the current InputState, and each message is handled by InputState>>pumpMessage:. That finds the corresponding window (probably a View instance) in its internal map of handles->Views, and it sends #preTranslateMessage: to that. If that doesn't consume the message it then it tries the window's parent, and so on. In none of them consume it, then the message is passed back to Windows for "dispatching" (as described in the above link), which means that Windows will directly call a handler function that it knows is associated with the corresponding window. As far as I know, all Dolphin windows use the same function, which is actually part of the VM (see VMLibrary>>getWndProc) itself. That function apparently invokes the #wndProc:message:wParam:lParam:cookie: method of the current InputState. So once again the InputState looks up the message in its map of handles->View instances, and this time sends #dispatchMessage:wparam:lParam: to the discovered View. From their the default handling is to look up the message in the "MessageMap" to find a corresponding selector, and the View instance then #perform:s that selector, so you then end up in one of the hundreds of little methods in category 'event handling-win32'. There -- finally -- the event is translated into MVP terms and ordinary Dolphin GUI code takes over. So, all in all, the two places where Windows events are passed to View instances are the #preTranslateMessage: and #dispatchMessage:wparam:lParam: methods. In both cases they are sent directly to the instance itself. (BTW, I didn't understand much, if any, of this before this morning; I've just spent a happy hour tracing through what happens. There were other things that I'd been planning to do with the time, but I had fun anyway. Thanks! ;-) -- chris |
Chris, Bill,
thank you all. Today is the day when I do finally go about writing my own UI framework. I've learned a lot since I started with Dolphin and ST, yet I don't expect it to be a smooth ride. I just noticed that I've been spending the majority of the development time of my app writing UI code, actually putting some scary hacks in there, and it still is pretty ordinary. Chris, your response gave exactly the explanation I needed, I had already traced much of it in the meantime. Wish me luck Günther |
Günther,
> Wish me luck Good luck! -- chris |
In reply to this post by Günther Schmidt
Günther,
> Today is the day when I do finally go about writing my own UI framework. > > I've learned a lot since I started with Dolphin and ST, yet I don't > expect it to be a smooth ride. I will make one last plea for you to consider generalizing the entrails of the Moen Tree, such that you will be producing a way to make arbitrary structures of moprh-like entities, but still plug and play with MVP as-is. I suspect the result would be very useful to the community. Either way you decide... > Wish me luck Done :) Have a good one, Bill -- Wilhelm K. Schwab, Ph.D. [hidden email] |
Free forum by Nabble | Edit this page |