Re: [Fxruby-users] Message Identifiers, Types, etc again.
Status: Inactive
Brought to you by:
lyle
From: Hugh S. S. E. E. <hg...@dm...> - 2003-06-13 19:24:35
|
On Fri, 13 Jun 2003, Lyle Johnson wrote: > Hugh Sasse Staff Elec Eng wrote: > > >> The ID_OPEN_FIRST message identifier tells the shutter to open its first > >> item, so let's make that the message identifier (or selector): > >> > >> openFirstButton.setSelector(FXShutter::ID_OPEN_FIRST) > >> > >> So now, when the user clicks this button, it will send a (SEL_COMMAND, > >> ID_OPEN_FIRST) message to the shutter. > > > > So this is sending the ID_OPEN_FIRST selector in the data part of > > the (sender, message, data) triple? > > No. The part of the (sender, message, data) triple is a number that > incorporates both the message type and identifier. In a previous e-mail, Oh, so that is why there was that stuff about MIN_ and MAX_ for these, sowhere in the docs (I can't remember where just now), because certain bitfields or ranges of number are allocated to each semantic part. OK, I'll have to poke about in the C++ with this partial knowledge, and I may get this.... > Sander referred to two methods you can use to extract the type and > identifier from the "message" value: > > def someMessage(sender, sel, data) > messageType = Fox.SELTYPE(sel) > messageId = Fox.SELID(sel) Yes, I remember this now. At the time I thought it was overkill if one could get the infomation from two separate parmeters! :-) > ... > end > > In most cases you actually don't need to do this, but the information's > there if you want it. I say that you don't need to do this because, [you know where you've been] > > > (Incidentally, I don't see setSelector in the http://www.fxruby.org/doc/api/ but that's BTW.) > > Yeah, this isn't spelled out clearly in the README part of the API docs, > but it should be. For all of the getter and setter methods (including > FXWindow#getSelector and FXWindow#setSelector) there are aliases that > instead make them look like regular Ruby attr_reader and attr_writer > methods. So if you look at the documentation for FXWindow: Hmm. Is this something we should talk to Dave about, options to Rdoc to make it flag up attrs in the methods pane? Thanks for this info. Would people coming to Ruby from FOX in C++ appreciate an alias for this? (Not that I can remember if RDoc includes aliases in the methods pane). > aWidget.selector = xxx > > which I thought was more compact. And more idiomatic for rubyists. > > Hope this helps, Yes, it is getting clearer. Thank you again. > > Lyle > > Hugh |