Hi,

> Mainly the MainClass' display method looks like this:
>  meth display(L)
>      {ForAll L proc{$ X}
>               {X displaypic(self.canvas)}
>            end
>      }
>
> while the displaypic method in the PicClass:
>  meth displaypic(Canvas)
>          Creation of a new image using QTk
>          Creating a tag using the parameter Canvas
>  end

As I understand, the PicClass instances run on a different site than
the MainClass, correct? I also assume that both MainClass and PicClass
instances are stationary objects, i.e. their methods are executed at
the site where the instances were originally created. (Correct me if
my assumptions are wrong.)

Can you find out where exactly the program fails? I think it is
probably in the displaypic method, but I wonder if it is before or
after the new image is created.

I don't have experience with using QTk in a distributed program. But
one possible problem is that QTk objects can (probably?) not
automatically be used on a site B when they have been created on a
site A. As a system module, QTk is a "sited" module and that indicates
some limitations (see also this message:
http://lists.gforge.info.ucl.ac.be/pipermail/mozart-users/2010/011503.html
).
You could try to create a stationary version of canvas by wrapping it
with MakeStat.like so:

meth display(L)
  StatCanvas = {MakeStat self.canvas}
in
     {ForAll L proc{$ X}
               {X displaypic(StatCanvas)}
           end
    }

(Although for performance reasons, you should ideally create the
stationary wrapper only once...)

Or you redesign the display method completely:

meth display(L)
  for X in L do
    Pic = {X createpic}
  in
    Creating a tag using the self.canvas
  end
end

But this is just an untested suggestion. I do not know at this point
whether creating QTk pictures on a remote site actually works. Maybe
it is necessary to create the pictures on the same site where they are
later used with the canvas.

> so I thought about using a ticket in order to make the MainClass's canvas 
> accessible.

I think using a ticket will not work here. Tickets are for granting
access to values to remote sites, but you DO already have a reference
to the canvas.

Cheers,
  Wolfgang
_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to