advertisement

Article:
  Embedding F-Script into Cocoa Applications
Subject:   thanks, example gave something to chew on
Date:   2002-08-11 04:46:37
From:   pmougin
Response to: thanks, example gave something to chew on

In order to configure the button (i.e. object1) we need to provides it with a target (i.e. an object), and the name of the message it must send to the target when clicked (this is the Cocoa target/action paradigm). The Cocoa API require for the "action" message to be a message with one and only one parameter. At run-time, when clicked, the button will send the message to its target, passing itself as the parameter (this allows the target to further interact with the button if needed).


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


1 to 1 of 1
  1. thanks, I believe # is F-scripts symbol and have distilled something
    2002-08-12 22:12:01  psheldon [View]

    • Re: thanks, I believe # is F-scripts symbol and have distilled something
      2002-08-14 10:54:48  pmougin [View]

1 to 1 of 1