| Sign In/My Account | View Cart |
| Article: |
Embedding F-Script into Cocoa Applications | |
| Subject: | IBLiveMode example needed story detailing scripting | |
| Date: | 2002-08-09 10:08:25 | |
| From: | pmougin | |
|
Response to: IBLiveMode example needed story detailing scripting
|
||
|
Note that object# variables are not script objects. In fact they are outlets that allows you to connect from F-Script to “external” object in IB. When you establish a connection from the F-Script window to an other objet in IB (via the IB connection mechanism (i.e. CONTROL+Drag)) then the connection inspector let you assign the target of the connection to one of the object# outlets. Once this is done, the object# variable becomes defined in the F-Script workspace and will evaluates to the connected object (let’s say, for example, a button). THEN, since you now have a handle on the button, you can configure it, from F-Script, the way you like. For instance, supposing you have connected the object1 outlet to a button, you can assign the button a block as target by typing in the live mode F-Script window: object1 setTarget:[sys beep]. object1 setAction:#value: When the button will be pressed, the block will be evaluated and play a beep…
|
||
Showing messages 1 through 4 of 4.
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.
;-)