Cannot identify the Menubar button clicked under Mac OS

Richard Gaskin ambassador at fourthworld.com
Tue Feb 25 13:48:49 EST 2020


Tore Nilsen wrote:
 > The problem here is that when a group is set to behave as a menubar on
 > MacOS, the target becomes the group and not any of the individual
 > buttons. Therefore the script as it is written in the tutorial will
 > not work, since the update of the menu will only happen if the short
 > name of the target is «window». It will work if you remove the
 > encapsulating if-statement.

Agreed: the engine behavior is fine, the Lesson script is written in a 
way I've never seen anyone attempt, and will fail.

Are the Lessons also at Github?  Would be nice if someone here has a 
moment to update that.

We should also consider adding a menu update example in the User Guide. 
Most of the Guide's discussion in "Programming Menus and Menu Bars" is 
pretty good, and there's even a useful example of handling menuPick, but 
no example for updating via mouseDown.


 > Removing the if-statement will update the content of the «Window» menu
 > regardless of which menu you choose, provided that the script is
 > placed in the group script. This way the user may well choose another
 > menu initially, slide to the «Window» menu and be presented with an
 > updated menu. So, while this may be a bug, the way around it is to
 > write less code. If only all problems could be solved this way.

Definitely not a bug, at least as far as original intent. Dr. Raney was 
quite clear when I discussed this with him some 20 years ago that he had 
no intention of jumping through the hoops that would be needed to try to 
treat the OS menu bar as a collection of LiveCode buttons.

A quick change to that one Lesson resolves the issue; extra bonus points 
if we add that to the User Guide as well.

Yes, if only everything else was this easy. I'd love to submit a pull 
request to a Lesson to make it possible to play video on Linux from 
within LC. :)

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the use-livecode mailing list