[squeak-dev] MenuMorph fitting to height of screen/window/etc

karl ramberg karlramberg at gmail.com
Fri Jun 20 17:10:35 UTC 2014


On Fri, Jun 20, 2014 at 12:00 AM, tim Rowledge <tim at rowledge.org> wrote:

> So far as I can see there is no code to make a MenuMorph do anything help
> when its height exceeds the screen (or indeed any other limit) unlike the
> old MVC CustomMenu et al.
>
> Is there anything there that I’m missing? I note the even the system menu
> -> add new morph -> from alphabetical list -> S-S menu exceeds any
> plausible height.
>

You can click and drag on the 2-3 outermost pixels on each side of the menu
to reposition it.
You can also right click to get to the halo and use a handle to move the
menu.
But it a automatic handling of long menus would be nice.

Actually PopUpMenu already handles this issue, the functionality could be
implemented in TheWorldMenu

PopUpMenu>>startUpWithCaption: captionOrNil icon: aForm at: location
allowKeyboard: aBoolean
"Display the menu, with caption if supplied. Wait for the mouse button to
go down, then track the selection as long as the button is pressed. When
the button is released,
Answer the index of the current selection, or zero if the mouse is not
released over  any menu item. Location specifies the desired topLeft of the
menu body rectangle. The final argument indicates whether the menu should
seize the keyboard focus in order to allow the user to navigate it via the
keyboard."

| maxHeight |
(ProvideAnswerNotification signal: captionOrNil) ifNotNil:
[:answer | ^ selection := answer ifTrue: [1] ifFalse: [2]].

maxHeight := Display height*3//4.
self frameHeight > maxHeight ifTrue:
[^ self
startUpSegmented: maxHeight
withCaption: captionOrNil
at: location
allowKeyboard: aBoolean].

^ Project current
dispatchTo: self
addPrefixAndSend: #StartUpWithCaption:icon:at:allowKeyboard:
withArguments: {captionOrNil. aForm. location. aBoolean}


Karl

>
> tim
> --
> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> USER ERROR: replace user and press any key to continue.
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20140620/d24e5489/attachment.htm


More information about the Squeak-dev mailing list