Page 1 of 1

Various problems with menu buttons and user guide

Posted: Sat Nov 27, 2010 7:50 am
by MichaelBluejay
Page 254 of rev 19 of the User Guide says:
If you change the currently-chosen menu item in option menus, also set the button's menuHistory property to the line number of the newly chosen item. This ensures that the new choice will be the one under the mouse pointer the next time the user clicks the menu.
(1) This wording isn't clear about whether the change they're talking about happens manually through a mouse action or through a script. I discovered on my own that menuHistory is actually set automatically when choosing with the mouse, but the User Guide doesn't mention that at all. This should be clarified.

(2) The UG says that the menuHistory determines what will be under the mouse pointer the next time the user clicks the menu. Not in my experience. Either the doc or the program should be changed so they agree.

(3) Getting something as simple as the selected menu item to be displayed and checked, and the previously selected item to be unchecked, takes a ridiculous amount of code (unless I'm missing something). This behavior is so basic I'd expect it to be built-in (which is my feauter request). This could be done with properties like "setLabelToSelection" and "setSingleCheckmarks". Here's the code I finally got working to do this for a popup menu. And in order for this to work, every menu item has to start with "!n".

Code: Select all

on menuPick theMenuItem
   put the menuHistory of me into currentLine
   global lastCheckedLine
   if lastCheckedLine is empty then put 1 into lastCheckedLine
   
   put line lastCheckedLine of me into lastCheckedText
   put "!n" & char 3 to the number of chars of lastCheckedText of lastCheckedText into line lastCheckedLine of me
   
   put currentLine into lastCheckedLine
   put "!c" & theMenuItem into line currentLine of me
   set the label of me to theMenuItem
end menuPick
(4) But that code doesn't work for an Option menu. In fact, if I put "!c" before an Option menu item, either in the Property Inspector or through a script, I see the literal "!c" in the menu item instead of a check mark.

Re: Various problems with menu buttons and user guide

Posted: Wed Jun 15, 2011 10:22 am
by tturner43
Is this for showing last 4 or 5 opened files in the case of a document based application?

Re: Various problems with menu buttons and user guide

Posted: Wed Jun 15, 2011 11:49 am
by BvG
I agree that menus suck horribly. Note that some menu styles do not accept modifiers, because they adhere to the gui guidelines of the os.