Professional Web Applications Themes

message passing via NSViews w/o actual Cocoa calls - Mac Programming

Hi, I'm fairly new to Cocoa programming; have been doing a few of the tutorials in Hillegass' book. I've spent some time with OGL though, so right now I'm trying to do a simple port of an app written a while back in glut using glui as a simple GUI interface. This question may have more to do with simple objective-c than with cocoa, but here goes. Here's my situation: I've managed to get multiple windows with subclasses of NSOpenGLView up and running and rendering simple polygons. I also have simple message passing thanks to IB; i.e. clicking an NSButton ...

  1. #1

    Default message passing via NSViews w/o actual Cocoa calls

    Hi, I'm fairly new to Cocoa programming; have been doing a few of the
    tutorials in Hillegass' book. I've spent some time with OGL though,
    so right now I'm trying to do a simple port of an app written a while
    back in glut using glui as a simple GUI interface. This question may
    have more to do with simple objective-c than with cocoa, but here
    goes.

    Here's my situation:

    I've managed to get multiple windows with subclasses of NSOpenGLView
    up and running and rendering simple polygons. I also have simple
    message passing thanks to IB; i.e. clicking an NSButton shows or hides
    a polygon. My problem is, thanks to Interface Builder, I can't seem
    to access either of the actual NSOpenGLView-subclasses as pointers.
    What I would ultimately like to do is be able to pass some information
    from one NSOpenGLView subclass to the other one, without having to go
    through IBOutlets and IActions. Interface Builder seems to hide quite
    a bit of information; i.e. when one creates a window and puts an
    NSOpenGLView inside it, where exactly is the pointer to the
    NSOpenGLView?

    searches for keywords such as "objective-c message passing", etc.
    didn't quite turn up what I was looking for, so if anyone has
    pointers, comments, or hints I would be much appreciative.

    thanks,
    matt
    matt Guest

  2. #2

    Default Re: message passing via NSViews w/o actual Cocoa calls

    matt <matthew.romainejp.sony.com> wrote:
    > Hi, I'm fairly new to Cocoa programming; have been doing a few of the
    > tutorials in Hillegass' book. I've spent some time with OGL though,
    > so right now I'm trying to do a simple port of an app written a while
    > back in glut using glui as a simple GUI interface. This question may
    > have more to do with simple objective-c than with cocoa, but here
    > goes.
    >
    > Here's my situation:
    >
    > I've managed to get multiple windows with subclasses of NSOpenGLView
    > up and running and rendering simple polygons. I also have simple
    > message passing thanks to IB; i.e. clicking an NSButton shows or hides
    > a polygon. My problem is, thanks to Interface Builder, I can't seem
    > to access either of the actual NSOpenGLView-subclasses as pointers.
    > What I would ultimately like to do is be able to pass some information
    > from one NSOpenGLView subclass to the other one, without having to go
    > through IBOutlets and IActions. Interface Builder seems to hide quite
    > a bit of information; i.e. when one creates a window and puts an
    > NSOpenGLView inside it, where exactly is the pointer to the
    > NSOpenGLView?
    >
    > searches for keywords such as "objective-c message passing", etc.
    > didn't quite turn up what I was looking for, so if anyone has
    > pointers, comments, or hints I would be much appreciative.
    What you're trying to do is no different from trying to get a reference
    to any other view on a window. Your button likely has an IBOutlet to
    your NSOpenGLView. That's the pointer you're looking for (actually an
    id, not a pointer, but the distinction isn't important in this context).
    You can set up your controller class (or whatever other class needs it;
    maybe the other gl views, maybe the window, and so on) with similar
    IBOutlets and then just play snap-together in IB.
    Paul Mitchum Guest

  3. #3

    Default Re: message passing via NSViews w/o actual Cocoa calls

    In <fa39fc69.0308122318.1f3bc5caposting.google.com > matt wrote:
    > when one creates a window and puts an
    > NSOpenGLView inside it, where exactly is the pointer to the
    > NSOpenGLView
    There are no "pointers" to anything inside IB. If you create an outlet
    in one instance and connect it to something else, that will be a
    "pointer". What's there is what you put there. 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

  4. #4

    Default Re: message passing via NSViews w/o actual Cocoa calls

    [email]usenetmile23.com[/email] (Paul Mitchum) wrote in message news:<1fzluvb.egrnvn14v03pcN%usenetmile23.com>...
    > What you're trying to do is no different from trying to get a reference
    > to any other view on a window. Your button likely has an IBOutlet to
    > your NSOpenGLView. That's the pointer you're looking for (actually an
    > id, not a pointer, but the distinction isn't important in this context).
    > You can set up your controller class (or whatever other class needs it;
    > maybe the other gl views, maybe the window, and so on) with similar
    > IBOutlets and then just play snap-together in IB.
    Paul, thanks. In the examples that I've done, IBOutlets have been
    attached to NSObjects, such as:

    IBOutlet NSButton *button;
    IBOutlet NSBox *box;

    but in my case, I just want one function in an NSOpenGLView to
    immediately call another one in a different NSOpenGLView; so is it
    legit to do:

    IBOutlet void function_that_calls_IAction_in_other_NSOpenGLVIew;

    ?

    Just want to confirm before I head down this path.

    thanks again,
    matt
    matt Guest

Similar Threads

  1. Getting the actual message being transmitted
    By Grigoris D in forum ASP.NET Web Services
    Replies: 1
    Last Post: November 15th, 09:40 PM
  2. Bit shifts in Cocoa
    By Korbin Meiser in forum Mac Programming
    Replies: 2
    Last Post: September 11th, 01:11 AM
  3. Cocoa Filemaker
    By Olly Groves in forum FileMaker
    Replies: 2
    Last Post: July 25th, 01:55 AM
  4. [Cocoa] Bug with NSTableView?
    By Mark Bee in forum Mac Programming
    Replies: 1
    Last Post: July 7th, 07:38 PM
  5. Async Message Passing Mechanism Wanted
    By John Ramsden in forum PERL Miscellaneous
    Replies: 0
    Last Post: June 25th, 02:59 PM

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