Re: Modal Menu in Pharo5

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

Re: Modal Menu in Pharo5

Peter Kenny
Christoph

It looks as though MenuMorph>>invokeModal should do what you want. The method comment has a useful code demo.

HTH

Peter Kenny

-----Original Message-----
From: Pharo-users [mailto:[hidden email]] On Behalf Of Christoph J. Bachinger
Sent: 28 April 2017 09:25
To: [hidden email].
Subject: [Pharo-users] Modal Menu in Pharo5

Hello,

I'm looking for a modal menu. It should stop method code execution until any left mouse klick. I tried MenuMorph with code like below, but this does not stop execution. Any hint?

thank you

cjb

ComposableModel subclass: #BachitophTestWindow
         instanceVariableNames: ''
         classVariableNames: ''
         poolDictionaries: ''
         category: 'Trimfox'.

BachitophTestWindow compile: 'initializeWidgets'.

     |window menu choice|
     window := BachitophTestWindow new openWithSpecLayout: SpecLayout composed.
     menu := MenuMorph new
         defaultTarget: window;
         color: (window theme menuColorFor: window);
         addToggle: 'abcabcabcabc' target: window selector:
#yourself"(labels at: 1)";
         addToggle: 'cdfgcdfgcdfg' target: window selector: #yourself;
         addLine;
         addToggle: 'hijkhijkhijk' target: window selector: #yourself;
         yourself.
     choice := menu popUpInWorld.
     choice selectedItem isNil
         ifTrue: [ choice := 'abc' ] ifFalse: [choice := choice selectedItem contents].
     self halt.




Reply | Threaded
Open this post in threaded view
|

Re: Modal Menu in Pharo5

bachitoph
Peter

Thanks, that's it :)

cjb