Various problems with menu buttons and user guide

Something you want to see in a LiveCode product? Want a new forum set up for a specific topic? Talk about it here.

Moderator: Klaus

Post Reply
MichaelBluejay
Posts: 230
Joined: Thu Jul 01, 2010 11:50 am

Various problems with menu buttons and user guide

Post by MichaelBluejay » Sat Nov 27, 2010 7:50 am

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.

tturner43
Posts: 21
Joined: Fri May 27, 2011 10:01 am
Contact:

Re: Various problems with menu buttons and user guide

Post by tturner43 » Wed Jun 15, 2011 10:22 am

Is this for showing last 4 or 5 opened files in the case of a document based application?

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: Various problems with menu buttons and user guide

Post by BvG » Wed Jun 15, 2011 11:49 am

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.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

Post Reply