Hi. John Sennesael and I have been hanging out on the #croquet
IRC channel and examining a problem we cannot figure out: How do you pragmatically open a Tweak window in a Croquet world? We looked at the code that creates a chat window and came up with the following procedure. On a Croquet-1.0.18 image: 1. Get a KAT demo (leave the server blank) 2. get the gray debug halo, and choose "inspect morph" 3. In the inspector, run "self harness avatar openWindow" This pops up a chat window in the croquet window, but also causes an error to appear, due to "Processor activeProject hand" being nil. Since this is a process-local variable, I guess I need to do some kind of future send in order to be running in the correct process. So, in the inspector, I try instead: self harness avatar future openWindow And nothing happens. How does one do this? I don't understand how tweak's event system works. The definitive article is not much help: http://tweakproject.org/TECHNOLOGY/Whitepapers/TweakEventArchitecture/ -- Matthew Fulmer -- http://mtfulmer.wordpress.com/ Help improve Squeak Documentation: http://wiki.squeak.org/squeak/808 |
> Hi. John Sennesael and I have been hanging out on the #croquet
> IRC channel and examining a problem we cannot figure out: > > How do you pragmatically open a Tweak window in a Croquet world? > > We looked at the code that creates a chat window and came up > with the following procedure. On a Croquet-1.0.18 image: > > 1. Get a KAT demo (leave the server blank) > 2. get the gray debug halo, and choose "inspect morph" > 3. In the inspector, run "self harness avatar openWindow" > > This pops up a chat window in the croquet window, but also > causes an error to appear, due to "Processor activeProject hand" > being nil. Since this is a process-local variable, I guess I > need to do some kind of future send in order to be running in > the correct process. So, in the inspector, I try instead: > > self harness avatar future openWindow > > And nothing happens. > > How does one do this? I don't understand how tweak's event > system works. The definitive article is not much help: > http://tweakproject.org/TECHNOLOGY/Whitepapers/TweakEventArchitecture It should also be noted that I tried the sample here: http://croquetweak.blogspot.com/2005/04/scripts-in-croquet.html which resulted in the vm freezing, in what seems like a semaphore deadlock. -John Sennesael |
In reply to this post by Tapple Gao
On 3/12/08, Matthew Fulmer <[hidden email]> wrote:
> Hi. John Sennesael and I have been hanging out on the #croquet > IRC channel and examining a problem we cannot figure out: > > How do you pragmatically open a Tweak window in a Croquet world? This is arguably not what you are doing. The Tweak stuff that is in the current images runs the Tweak world in the Croquet window, but in the local user area outside of the replicated space. The Tweak windows that open up for various things can communicate with the replicated island, but are not in it. > We looked at the code that creates a chat window and came up > with the following procedure. On a Croquet-1.0.18 image: > > 1. Get a KAT demo (leave the server blank) > 2. get the gray debug halo, and choose "inspect morph" > 3. In the inspector, run "self harness avatar openWindow" > > This pops up a chat window in the croquet window, but also > causes an error to appear, due to "Processor activeProject hand" > being nil. I can give you a half-cocked empirical answer, but someone else will have to give the definitive answer. There are at least a couple of different processes running, and when you are trying to run this, you're in the wrong process context. There is a half-cocked way to fix the error that you got, which is shown at the bottom of the page at http://croquetconsortium.org/index.php/Peer-to-Peer_Chat_in_Tweak This is all part of the fun way that Morphic and Tweak (especially event handling) uncomfortably coexist in Croquet. The code that runs to service the menu items mostly avoids this little problem because they are invoked from the Tweak world menu. I guess that even then, it's not really a sure thing. > Since this is a process-local variable, I guess I > need to do some kind of future send in order to be running in > the correct process. So, in the inspector, I try instead: > > self harness avatar future openWindow > > And nothing happens. > > How does one do this? I don't understand how tweak's event > system works. The definitive article is not much help: > http://tweakproject.org/TECHNOLOGY/Whitepapers/TweakEventArchitecture/ > > -- > Matthew Fulmer -- http://mtfulmer.wordpress.com/ > Help improve Squeak Documentation: http://wiki.squeak.org/squeak/808 > Dave |
David Faught wrote:
> I can give you a half-cocked empirical answer, but someone else will > have to give the definitive answer. There are at least a couple of > different processes running, and when you are trying to run this, > you're in the wrong process context. There is a half-cocked way to > fix the error that you got, which is shown at the bottom of the page > at http://croquetconsortium.org/index.php/Peer-to-Peer_Chat_in_Tweak > This is all part of the fun way that Morphic and Tweak (especially > event handling) uncomfortably coexist in Croquet. The code that runs > to service the menu items mostly avoids this little problem because > they are invoked from the Tweak world menu. I guess that even then, > it's not really a sure thing. ask this: What is the easiest, shortest, method of creating an (empty) tweak window inside a croquet harness/space/wherever when it starts? As I have noted in my previous post, I tried the sample at: http://croquetweak.blogspot.com/2005/04/scripts-in-croquet.htm which causes the croquet harness to wait forever. I ran the code in the world initialize method. Based upon what you are telling me, I am running this code from the wrong process. Then where do I put the code? We tried deriving some classes from CroquetMenuProject/CroquetMenuWorld trying to overload setupCostume and onBootstrap but this didn't work either. You can find the code for this here: http://jabberwocky.croquetproject.org:8889/tabletop/ If anyone could tell us why it isn't working and/or what we are doing wrong it would be greatly appreciated! -John Sennesael |
On Mar 12, 2008, at 13:55 , John Sennesael wrote:
> As I have noted in my previous post, I tried the sample at: > http://croquetweak.blogspot.com/2005/04/scripts-in-croquet.htm which > causes > the croquet harness to wait forever. These code snippets refer to a rather early version of Croquet (you may have noticed the 2005 post date). Much has changed since, so I am not surprised it does not work anymore. The trick to make this run without problems is that you have to be in the right context. This is not simple from Morphic. But from Tweak it is simple. For example, to open a workspace in KAT, insert two lines in KMenuBar>>menuBarNewMenu: menuBarNewMenu | menu | menu := CMenu new. menu add: 'Workspace' target: self action: #actionNewWorkspace. menu addSeparator. menu add: 'Space' target: self action: #actionNewSpace. ... and add a method actionNewWorkspace actionNewWorkspace CWorkspace open Then open KAT Demo, choose New - Workspace. As simple as it gets. From this workspace you can easily experiment with Tweak objects: p := CPlayer open. p color := Color red. 0 to: 500 by: 5 do: [:i | p left: i; wait: 0.1]. p close Notice how this nicely animates while you can still interact with Croquet :) You could as well start this snippet from the menu, make a method like actionAnimDemo self startScript: [ | p | p := CPlayer open. p color := Color red. 0 to: 500 by: 5 do: [:i | p left: i; wait: 0.1]. p close ]. - Bert - |
Free forum by Nabble | Edit this page |