sticking VNC in TWindow

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

sticking VNC in TWindow

KiranMutt
Hello,
 
Below is the code snippet i am calling to create a VNC view from SailingDemo ( to enable VNC ).
How do i get access to current space to add the TWindow as an TEmbeddedApp.
How do i stick VNC in window basically?
 
Thanks so much for your inputs. Also correct me if there is anything wrong.
 
 
 
------------------------------------------------------------------------------------------------------------------------------
 
 | passwordString addressString  port app win replica root eventFrame |
    addressString := UIManager default request: 'Address of VNC server on network'
        initialAnswer: (addressString ifNil: ['']).
 port := UIManager default request: 'VNC display number'
        initialAnswer: (port ifNil: ['0']).
 passwordString := UIManager default request: 'VNC password. Other participants will not be asked for this. They will not see it displayed in Croquet, but it is available to Squeak.'
        initialAnswer: (passwordString ifNil: ['']).
     port:=5900.

  app:=TEmbeddedApp name: #TMorphicWorld
  extent: [hidden email]
     data: { #makeRFB:address:port:. passwordString. addressString. port }.

     win := TWindow new.
-----------------------------------------------------------------------------------------------------------------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: sticking VNC in TWindow

Howard Stearns
The crucial concept here is understanding the context in which you're trying to
do something.  Depending on the context:

   1. You might have "self" or some other binding available that either is the
object you want or is some other object through which you can get what you want.
The context will determine what the thing you want is called, or what
referencing chain you use to reach it. We try very hard NOT to have global
variables (i.e., where everything you or anyone else will ever create has some
globally unique name that always works regardless of context).

For example, some of your code, below, was lifted from methods on Harness, from
which "self activeSpace" gets you the space that your avatar is currently in.
Other parts of your code was lifted from methods on a Tweak menu bar, from which
"hand world ownerMorph harness activeSpace" can be used. (Yuck!)

   2. You might be "on-island" or "off-island". This will determine how you use
the reference so that everyone in the collaboration gets the same result.

For real code in a real application written in the "Croquet way", almost all of
your code will be "on-island", which means that the same code is already
executing on everyone's machine, and you can just not worry about replication
and there's no network traffic at all.  But someone needs to kick off that
replication by sending (ideally just one) network message from outside the
island, which will get distributed through the router to each participant.
(http://opencroquet.org/index.php/The_Core_Model)  This is done from
"off-island" using a #future message on a far (e.g., external) reference to an
object.  Where the context of your code is the Harness or a Tweak menu, you are
off-island and all the references you have (e.g., the object answered by
#activeSpace) is automatically a far reference.

I frequently write code "on the fly" to try things out -- e.g., in the workspace
pane of an inspector.  If I inspect the space (e.g., Tools->Explore Space or
Tools->Space Information in the KAT), then "self" is a far reference to the
space. If I inspect a particular object (e.g., using the context menu on an
object in the KAT and selecting 'Explore' or 'Information', then 'self' is a far
reference to the object (and the space is "self future root"). In all these
cases, the inspector workspace is off-island.  But if I drill down through
container objects in an inspector, I can cheat and click directly on the "near"
object.  Then I just send "self" messages as though I were on-island (no
#future), but if I were connected to someone else, they wouldn't see my messages
and our collaboration would diverge. I would be breaking Croquet.

There's an exercise for exploring these concepts at:
http://www.nabble.com/Re%3A--croquet--get-a-handle-to-an-object-p8773178.html



Kiran wrote:

> Hello,
>  
> Below is the code snippet i am calling to create a VNC view from
> SailingDemo ( to enable VNC ).
> How do i get access to current space to add the TWindow as an TEmbeddedApp.
> How do i stick VNC in window basically?
>  
> Thanks so much for your inputs. Also correct me if there is anything wrong.
>  
>  
>  
> ------------------------------------------------------------------------------------------------------------------------------
>  
>  | passwordString addressString  port app win replica root eventFrame |
>     addressString := UIManager default request: 'Address of VNC server
> on network'
>         initialAnswer: (addressString ifNil: ['']).
>  port := UIManager default request: 'VNC display number'
>         initialAnswer: (port ifNil: ['0']).
>  passwordString := UIManager default request: 'VNC password. Other
> participants will not be asked for this. They will not see it displayed
> in Croquet, but it is available to Squeak.'
>         initialAnswer: (passwordString ifNil: ['']).
>      port:=5900.
>
>   app:=TEmbeddedApp name: #TMorphicWorld
>   extent: 800@600 <mailto:800@600>
>      data: { #makeRFB:address:port:. passwordString. addressString. port }.
>
>      win := TWindow new.
> -----------------------------------------------------------------------------------------------------------------------------------------------

--
Howard Stearns
University of Wisconsin - Madison
Division of Information Technology
mailto:[hidden email]
jabber:[hidden email]
voice:+1-608-262-3724