Professional Web Applications Themes

Outlet between 2 controller object - Mac Programming

In Interface Builder the IBOulet "from_A_to_B" was added to Controller_A and a connection made from Controller_A to Controller_B Controller_A.m hold the code int v; v = [from_A_to_B test_int]; Controller_A.h hold the declaration (in interface Controller_A : NSObject) IBOutlet id from_A_to_B; Controller_B.m hold the code - (int)test_int { return 12345; } Controller_B.h hold the declaration - (int)test_int; The compiler report this error Error : unknown message selector Controller_A.m line 13 v = [from_A_to_B test_int]; Do I have made an illegal IB connection ? What code is missing/wrong ? Thank you....

  1. #1

    Default Outlet between 2 controller object

    In Interface Builder the IBOulet "from_A_to_B" was added to Controller_A
    and a connection made from Controller_A to Controller_B

    Controller_A.m hold the code

    int v;

    v = [from_A_to_B test_int];

    Controller_A.h hold the declaration (in interface Controller_A : NSObject)

    IBOutlet id from_A_to_B;

    Controller_B.m hold the code

    - (int)test_int
    {
    return 12345;
    }

    Controller_B.h hold the declaration

    - (int)test_int;

    The compiler report this error

    Error : unknown message selector
    Controller_A.m line 13 v = [from_A_to_B test_int];

    Do I have made an illegal IB connection ?
    What code is missing/wrong ?

    Thank you.
    Alain Birtz Guest

  2. #2

    Default Re: Outlet between 2 controller object

    In <abz-1609031544460001192.168.1.3> Alain Birtz wrote:
    > The compiler report this error
    >
    > Error : unknown message selector
    > Controller_A.m line 13 v = [from_A_to_B test_int];
    >
    > Do I have made an illegal IB connection ?
    > What code is missing/wrong ?
    You need to learn Objective-C. The form of an Objective-C method call is:

    [classOrInstance methodName];

    You have just [methodName] alone, which is meaningless. m.

    --
    matt neuburg, phd = [email]matttidbits.com[/email], [url]http://www.tidbits.com/matt[/url]
    REALbasic: The Definitive Guide! 2nd edition!
    [url]http://www.amazon.com/exec/obidos/ASIN/0596001770/somethingsbymatt[/url]
    Subscribe to TidBITS. It's free and smart.
    matt neuburg Guest

  3. #3

    Default Re: Outlet between 2 controller object

    But from_A_to_B is just a "classOrInstance"
    By example to get a pointer to an NSWindow from an IBOutlet
    named main_wind the [main_wind window] is uded.
    from_A_to_B is an IBOutlet to the Controller_B object
    In fact the problem is only a missing declaration.
    Adding the 3 line below in Controller_A.h solve the problem

    interface Controller_B : NSObject
    - (int)test_int;
    end

    In Controller_A.m the v value is correctly set to 12345 by the instruction

    v = [from_A_to_B test_int];

    But there is one thing I am not sure: is it correct to connect two controller
    object (with an IBOutlet) in this way...

    Thank you.

    In article <20030916155043535-0700news.la.sbcglobal.net>, matt neuburg
    <matttidbits.com> wrote:
    > In <abz-1609031544460001192.168.1.3> Alain Birtz wrote:
    > > The compiler report this error
    > >
    > > Error : unknown message selector
    > > Controller_A.m line 13 v = [from_A_to_B test_int];
    > >
    > > Do I have made an illegal IB connection ?
    > > What code is missing/wrong ?
    >
    > You need to learn Objective-C. The form of an Objective-C method call is:
    >
    > [classOrInstance methodName];
    >
    > You have just [methodName] alone, which is meaningless. m.
    Alain Birtz Guest

  4. #4

    Default Re: Outlet between 2 controller object

    Alain Birtz <abzvideotron.ca> wrote:
    > But from_A_to_B is just a "classOrInstance"
    Right - sorry! m.


    --
    matt neuburg, phd = [email]matttidbits.com[/email], [url]http://www.tidbits.com/matt/[/url]
    Read TidBITS! It's free and smart. [url]http://www.tidbits.com[/url]
    matt neuburg Guest

  5. #5

    Default Re: Outlet between 2 controller object

    [email]abzvideotron.ca[/email] (Alain Birtz) wrote in message news:<abz-1609031544460001192.168.1.3>...
    > The compiler report this error
    >
    > Error : unknown message selector
    > Controller_A.m line 13 v = [from_A_to_B test_int];
    >
    > Do I have made an illegal IB connection ?
    > What code is missing/wrong ?
    >
    > Thank you.
    Are you sure this was an error? or was it just a warning? Or is your
    compiler set to treat all warnings as errors?

    I think you just need to import Controller_B.h from Controller_A.m.
    Usually this makes a warning instead of an error...

    Michael
    Michael Milvich Guest

  6. #6

    Default Re: Outlet between 2 controller object

    [email]abzvideotron.ca[/email] (Alain Birtz) wrote in message news:<abz-1609031544460001192.168.1.3>...
    > Do I have made an illegal IB connection ?
    > What code is missing/wrong ?
    Simple problem.
    > IBOutlet id from_A_to_B;
    The "id" means "it's an object of unspecified type." The compiler
    does not know to look in Controller_B.h.

    You can fix it by changing it to

    IBOutled (Controller_B *) from_A_to_B;

    In the future, you can make this kind of thing not happen by,
    when creating an outlet, giving it a type using the pull-down
    menu. I'm guessing you probably didn't do that, not knowing
    what it was for. Well, this is what it's for.
    Eric Pepke Guest

  7. #7

    Default Re: Outlet between 2 controller object

    In CW 8.0 this is a (Compiler or Linker) error not a warning...

    In article <21ff4ea2.0309171018.2ec08b10posting.google.com >,
    [email]michaelmilvich.com[/email] (Michael Milvich) wrote:
    > [email]abzvideotron.ca[/email] (Alain Birtz) wrote in message
    news:<abz-1609031544460001192.168.1.3>...
    > > The compiler report this error
    > >
    > > Error : unknown message selector
    > > Controller_A.m line 13 v = [from_A_to_B test_int];
    > >
    > > Do I have made an illegal IB connection ?
    > > What code is missing/wrong ?
    > >
    > > Thank you.
    >
    > Are you sure this was an error? or was it just a warning? Or is your
    > compiler set to treat all warnings as errors?
    >
    > I think you just need to import Controller_B.h from Controller_A.m.
    > Usually this makes a warning instead of an error...
    >
    > Michael
    Alain Birtz Guest

Similar Threads

  1. Temperature controller
    By hugovr in forum Macromedia Flash Data Integration
    Replies: 1
    Last Post: October 8th, 07:54 PM
  2. Removing a controller
    By John C. Weldin in forum Windows Server
    Replies: 0
    Last Post: June 17th, 01:28 PM
  3. cue point controller?
    By techtigger webforumsuser@macromedia.com in forum Macromedia Director Lingo
    Replies: 3
    Last Post: October 22nd, 06:18 PM
  4. ActiveX-controller
    By Knut Vang in forum Macromedia Flash
    Replies: 0
    Last Post: August 30th, 08:23 AM
  5. A1000 controller
    By Terry in forum Sun Solaris
    Replies: 1
    Last Post: June 27th, 07:37 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139