|
object1 setTarget:[sys beep]. object1 setAction:#value:
Here, in guessing a parsing of this statement for meaning, I use my dumb in hindsight gestalt. Object is not action ie. noun is not verb.
Here # means the last statement's objects output, much as in maple computer algebra language % does. In maple I learned a writing "style with %" that helps sequential interactive developement of a compound statement in a >-promt-line of code. I suppose that I will learn a similar style in F-Script.
object1, through connection I made in IB, now stands for the button. I want the (button) control to do something. I have certain syntactic elements in F-Script to build with. I always do something in an object oriented language by sending a message to an object. Thence, I have to set a target object and say what action I want it to take.
In the line of F_script code example, in the language of IB, the button gets associated with an action. In the MVC notion of things the F-Script object is the controller while value: is the action in the controller with # abbreviating.
Yet, here is a surprise that confusing and means an emerging more powerful conceptualization.
You made the syntax of F-Script so it would be wrong to simply write :
object1 setAction: [sys beep] value:
I have some vague memory in ObjC.pdf book about what wiring really means in IB. The memory was vague because the writing was very terse, I believe to hide initially a level of detail that would scare an early reader.
So, now that I am not an early reader, perhaps you can put in words I can swallow why not my proposed abbreviation, ie. why the above syntax doesn't confuse me but would confuse the computer.
;-)
Also, I don't have a clue how to make an outlet. So, what section of your book would I read for actions and outlets. It might give some introduction as to what is going on. Maybe, if console works, the computer would complain to me when I wrote it my abbreviated statement. I'm getting that experimental itch! Good.
;-)
|
In our case the target is an F-Script block. Our goal is to execute this block when the button is clicked. As you know, in order to execute a block, you send it a "value..." style message (the exact message depends on the number of parameters the block is expecting). Here, we configure the button with the "value:" message name, which is the one that takes one parameter (in the example, our block doesn't make use of this parameter).
Note that "#value:" represent the name of a message. What in Objective-C is called a message selector. So in fact it is (in F-Script) an object, but an object whose job is to represent the name of a message. It is a noun that describe a verb.
The target-action paradigm is described in the Apple Objective-C book, as well as some notions about outlets. I would also recommend you to get the Hillegass Cocoa book (see http://www.bignerdranch.com/Book/).
Phil