[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with MacOS menu handling



At 10:57 AM +0100 11/8/01, Peter Lane wrote:
>Dear list,
>
>I have some code for displaying a popup menu when the user 
>right-clicks within a canvas object.  This popup menu contains 
>simple selection choices ('save', 'close') and also a check box and 
>submenu. Although working as intended on the PC, the more complex 
>menu items don't transfer to the MacOS.  There are two problems.
>
>The first is with the checkable menu -- although the callback 
>procedure is called, the checkable item state is not changed by the 
>system.  Hence, the line (send e check ...) in the sample below:
>
>;; check item to determine whether the stages are displayed
>(make-object checkable-menu-item% "Show stages" my-popup
>    (lambda (e v)
>       ;; explicit change required on Mac only
>       (send e check (not (send e is-checked?)))
>       (set-show-stages! (send e is-checked?)) #f #f))
>
>Note, this problem also occurs if the checkable item is part of a 
>menu on the menu-bar.

Can you submit a bug report on this?  This looks like a bug to me.

>The second problem is with the submenu -- although appearing on the 
>popup, the submenu does not appear.  The code I used is as below.
>
>;; create a sub-menu on popup for selecting type of automatic peaks
>(let ((peaks-menu (make-object menu% "Show peaks" my-popup #f)))
>    (make-object menu-item% "No peaks" peaks-menu
>       (lambda (e v) (clear-my-peaks)) #f #f)
>    (make-object menu-item% ">= 2 seconds" peaks-menu
>       (lambda (e v) (set-my-peaks! (get-large-values (graph-points)))) #f #f)
>    (make-object menu-item% "Local maxima" peaks-menu
>       (lambda (e v) (set-my-peaks! (get-local-maxima (graph-points)))) #f #f))
>
>This problem is not present if the submenu is part of a menu on the menu-bar.
>
>I cannot see anything in the documentation specific to problems with 
>the MacOS interface to these functions.  Is this a bug, or do I need 
>to add something extra to the sub-menu code, like with the 
>checkable-menu-item?  I would guess the code handling selection of 
>these widgets is not being called on the Mac, although the callback 
>is -- the simple menu items work happily enough.

This is a known bug.  I hope to have it fixed in version 200, though 
nothing's certain at this point.

john clements