Re: [Fxruby-users] OO documentation issues.
Status: Inactive
Brought to you by:
lyle
|
From: Hugh S. S. E. E. <hg...@dm...> - 2003-06-12 16:00:52
|
On Thu, 12 Jun 2003, Lyle Johnson wrote:
> Hugh Sasse Staff Elec Eng wrote:
>
> > Things that have puzzled me about this target message sytem include:
> > the target is fixed at construction time.
>
> No. The target is initialized at construction time, but it is not
> "fixed". You can change it at any time using the setTarget() method, or
> by "re-connecting" the widget to some other proc, or whatever. It is
> (can be) very dynamic if that makes sense for your application.
Oh, I see, thanks.
>
> > The messages have types and ids.
[...]
> I'm not sure I follow, so I'll just give you my summary of how message
[...]
>
> First, the boring part.
>
> Message types are used to distinguish between the different kinds of
> messages that a widget can *send*. If we consider the FXButton widget as
[...]
> we see that it can send one of five different message types
> (SEL_KEYPRESS, SEL_KEYRELEASE, SEL_LEFTBUTTONPRESS,
> SEL_LEFTBUTTONRELEASE or SEL_COMMAND) to its target object.
>
> Of course, the button's target may getting messages from *other* widgets
> as well. So it needs some way to distinguish between SEL_KEYPRESS
> messages coming from, say, button #1, and SEL_KEYPRESS messages coming
> from button #2. And that's where the message identifier comes in.
OK, reading this in conjunction with paragraphs 3 and 4 of
http://www.fox-toolkit.org/messages.html
it seems that message_id is actually the sender of the message, and
message type is actually the message itself (not counting associated
data). I would have called the message itself the message_id,
divided gruops of ids into types, and called the sender "sender" or
"sender_id"! No wonder I was confused. Message_id doesn't identify
the message, only the sender (well, it's useless without an
acompanying message, but still)!)
>
> Message identifiers are most often used to distinguish between different
> senders of the same type of message. Since the message identifiers are
> used by the receiver of the message (i.e. the target), they just need to
> be unique for that class of objects and do not need to be globally unique.
OK, that's clearer now. Thank you.
>
> Now, the less boring part.
>
> For many FXRuby applications, you don't need to get *too* hung up on the
> details of how FOX's message-target system works under the hood. As
> discussed in detail here:
>
> http://www.fxruby.org/doc/events.html
>
> A lot of the ugly details have been hidden for the most common
> applications in FXRuby.
Yes, I like that elegance.
>
> > I suppose there is
> > an analogy here with the Ruby send() method, except that one must
[...]
> Yes, and this is largely due to some fundamental differences between C++
> and Ruby. The C++ language doesn't have any way to "send" a message to
[...]
> system. It is no secret that he would have preferred to have written FOX
> in Objective-C, where this kind of messaging would have been more
> natural, but for pragmatic reasons he went with C++ ;)
:-) For pragmatic reasons I gave up on C++ and went with Ruby for
most of my work! :-)
>
>
Thank you
Hugh
|