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

Problems with MacOS menu handling




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.

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.

	thanks for any help,

		Peter.

-- 
---------------------------------------------------------------
Dr. Peter Lane
ESRC Centre for Research in Development,
Instruction and Training (CREDIT)
School of Psychology, University of Nottingham
NOTTINGHAM  NG7 2RD, England

Email: pcl@psychology.nottingham.ac.uk
Tel:   + 44 (0) 115 951 5310
Fax:   + 44 (0) 115 951 5324
URL:   http://www.psychology.nottingham.ac.uk/staff/Peter.Lane
---------------------------------------------------------------