PopUpMenu in Croquet

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

PopUpMenu in Croquet

Jerome Fuselier
Hello,
  I've just started to play with Croquet and I don't really understand
why what I'm doing is not working.

I've done a simple morphic project that binds a PopUpMenu to a mouseDown
event on a RectangleMorph. It works well in "2D" but when I load the
project in a Croquet 3D island (IntroWorld), the PopUpMenu does not
appear in the TWindow (but it has appeared when I go back inside the
projects in 2D). Is it normal ? And if it is, how can I do such a thing ?

Another question is how can I define the part of a morphic project that
will be visible when I load it in a 3d island ? Actually, when I load a
project I only see a small portion of the project and I'm not able to
create a "real" application that looks finished...

Thanks,
  Jérôme





Reply | Threaded
Open this post in threaded view
|

Re: PopUpMenu in Croquet

Andreas.Raab
Jerome Fuselier wrote:
> I've done a simple morphic project that binds a PopUpMenu to a mouseDown
> event on a RectangleMorph. It works well in "2D" but when I load the
> project in a Croquet 3D island (IntroWorld), the PopUpMenu does not
> appear in the TWindow (but it has appeared when I go back inside the
> projects in 2D). Is it normal ? And if it is, how can I do such a thing?

It is not uncommon. One of the big weaknesses of Morphic is its reliance
on global state, i.e., it assumes that there is only ever one morphic
world (project) active. I spent some time fixing the most grievous
problems for our demos but Morphic worlds can be extremely tricky to
work with. In your case, it really depends on how the pop up menu is
launched. I'm not even sure how to do it correctly (I don't use Morphic
for these tasks any longer) but try this:

MyMorph>>mouseDown: evt
   menu := self buildMenu.
   menu popUpForHand: evt hand in: evt hand world.


> Another question is how can I define the part of a morphic project that
> will be visible when I load it in a 3d island ? Actually, when I load a
> project I only see a small portion of the project and I'm not able to
> create a "real" application that looks finished...

Change the size of the embedded app. The default looks like this:

   morphic := TEmbeddedApp name: #TMorphicWorld extent: 512@512
     data: {#makeMorph:. BouncingAtomsMorph}.

which gives you a 512@512 project; if you need more you need to change
the extent.

Cheers,
   - Andreas
Reply | Threaded
Open this post in threaded view
|

Re: PopUpMenu in Croquet

Jerome Fuselier
Andreas Raab wrote:

> Jerome Fuselier wrote:
>> I've done a simple morphic project that binds a PopUpMenu to a
>> mouseDown event on a RectangleMorph. It works well in "2D" but when I
>> load the project in a Croquet 3D island (IntroWorld), the PopUpMenu
>> does not appear in the TWindow (but it has appeared when I go back
>> inside the projects in 2D). Is it normal ? And if it is, how can I do
>> such a thing?
>
> It is not uncommon. One of the big weaknesses of Morphic is its
> reliance on global state, i.e., it assumes that there is only ever one
> morphic world (project) active. I spent some time fixing the most
> grievous problems for our demos but Morphic worlds can be extremely
> tricky to work with. In your case, it really depends on how the pop up
> menu is launched. I'm not even sure how to do it correctly (I don't
> use Morphic for these tasks any longer)
May I know what you are using now ?
> but try this:
>
> MyMorph>>mouseDown: evt
>   menu := self buildMenu.
>   menu popUpForHand: evt hand in: evt hand world.
It has worked for me thanks. I still have some blinking problems,
probably due to a drawOn: message that I redefined for my project, but
that will do for a demo.

>
>
>> Another question is how can I define the part of a morphic project
>> that will be visible when I load it in a 3d island ? Actually, when I
>> load a project I only see a small portion of the project and I'm not
>> able to create a "real" application that looks finished...
>
> Change the size of the embedded app. The default looks like this:
>
>   morphic := TEmbeddedApp name: #TMorphicWorld extent: 512@512
>     data: {#makeMorph:. BouncingAtomsMorph}.
>
> which gives you a 512@512 project; if you need more you need to change
> the extent.
I didn't see that parameter thanks again, it helps me. It is not still a
real application like in classical windowing system (with a well-defined
client area that I control and the separation between the application
and the instance) but it's probably due to my lack of comprehension of
the whole platform.


Thanks,
  Jérôme
Reply | Threaded
Open this post in threaded view
|

Re: PopUpMenu in Croquet

Bert Freudenberg
On May 4, 2007, at 10:12 , Jerome Fuselier wrote:

> Andreas Raab wrote:
>> I don't use Morphic for these tasks any longer)
> May I know what you are using now ?

Most recent Croquet projects use Tweak for their 2D UI, which is  
included in the Croquet SDK. There is some documentation at

        http://tweakproject.org/


I'd suggest you start with the Bank Account tutorial, which is more  
interesting than it sounds ;)

        http://tweakproject.org/TECHNOLOGY/Tutorials/BankAccountTutorial/

- Bert -