Distributed GUI

  • Hello,
    I want to develop an application which GUI will consist of
    distributed objects.
    I get unintended results - what am I doing wrong?

    --------------------------------------- code snips:

    ***** client:
    - (byref id) aquaView {
        if (!aquaView) {
        aquaView = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0,
    300, 20)];
        [aquaView setStringValue:@"Distant view! Yupiii!"];
        }
        return aquaView;
    }

    ***** server (where the view should appear):
          id target=[[NSConnection
        rootProxyForConnectionWithRegisteredName:toBeAddedName
                                            host:nil] retain];
          if (target==nil) {
              NSLog(@"Agent '%@' doesn't exist",toBeAddedName);
              return nil;
          }

          // add new tab
          NSTabViewItem* tab = [[NSTabViewItem alloc]
    initWithIdentifier:toBeAddedName];
          [tab setLabel:toBeAddedName];
          [view addTabViewItem:tab];

          // tab's view should be aquaView of the distant object
          id targetView = [target aquaView];
          NSLog(@"Target view: %@",targetView);
          NSLog(@"Target NSTextField value: %@",[targetView stringValue]);
          [tab setView:targetView];

    ---------------------------------------

    When I run the client and the server, I get:

    2007-09-30 10:11:13.151 LLDesk[4910] Target view: <NSTextField:
    0x3193f0>
    2007-09-30 10:11:13.151 LLDesk[4910] Target NSTextField value:
    Distant view! Yupiii!

    So everything seems OK. But when I click on the newly created tab,
    the application simply hangs.

    I suppose the whole thing has something to do with notifications and
    should be done somehow else, but I don't know how :(

    Thanks for any advices, I'm totaly lost :(

    M. Prymek
  • Miroslav Prymek <mailto:<prymek...> wrote (Sunday,
    September 30, 2007 1:17 AM +0200):

    > I want to develop an application which GUI will consist of distributed objects.
    > I get unintended results - what am I doing wrong?

    Some objects can't be distributed. Most notably objects that
    have to interact with the window manager or do any kind of image
    processing. The data in those objects are accessed directly and
    must exist in the address space of the local machine.

    In general, view objects must be local. Data model and control
    object can be distributed.

    --
    James Bucanek
  • On 10/1/07, James Bucanek <subscriber...> wrote:

    > In general, view objects must be local. Data model and control
    > object can be distributed.

      ... to that end, if you really do need to "send UI" via DO, why not
    simply send a "view descriptor" object and let the local app construct
    an appropriate view itself?

    --
    I.S.
  • James Bucanek <mailto:<subscriber...> wrote (Monday,
    October 1, 2007 8:15 AM -0700):
    > Some objects can't be distributed. Most notably objects that have to
    > interact with the window manager or do any kind of image processing.
    > The data in those objects are accessed directly and must exist in the
    > address space of the local machine.

    ... and when I wrote "machine" I really meant "process."

    I. Savant <mailto:<idiotsavant2005...> wrote (Monday,
    October 1, 2007 10:37 AM -0400):
    > On 10/1/07, James Bucanek <subscriber...>  wrote:
    >
    >> In general, view objects must be local. Data model and control
    >> object can be distributed.
    >
    > ... to that end, if you really do need to "send UI" via DO, why not
    > simply send a "view descriptor" object and let the local app construct
    > an appropriate view itself?

    My aging brain cells tell me that someone already did this, or
    something similar. Search the archives. I vaguely remember
    running across some code that someone posted for a distributed
    Cocoa control view.

    --
    James Bucanek
previous month september 2007 next month
MTWTFSS
          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
Go to today