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.