"Enabled of menuitem" doesn't work on Windows standalone

Deploying to Windows? Utilizing VB Script execution? This is the place to ask Windows-specific questions.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bd525
Posts: 80
Joined: Sun Aug 31, 2014 12:43 am

"Enabled of menuitem" doesn't work on Windows standalone

Post by bd525 » Sun Oct 15, 2023 3:12 pm

I develop on Mac. Everything is fine with standalones of my main app for both Mac and Windows. I'm ready to "go live" on my website and publicize my app and website by email blasts and other means.

Just one problem remains: The plan is to include Mac and Windows demo versions of my app with only certain features enabled. In the openStack handler demoRunning is the relevant variable (true or false). The code is:

set the enabled menuItem i of button "Some Button Name" to (not demoRunning).

After the standalone creation process for the demo version everything is fine on the created Mac standalone. The menuItems designated as inactive in the openStack handler are greyed out and non-functional, as desired. But on Windows the menuItems are still active, and display with the "(" character visible as the first character, which just ain't right.

I haven't been able to find anything in Livecode documentation about Mac vs. Windows differences in implementing this capability. Any ideas what the solution is?

cpuandnet
Posts: 32
Joined: Thu Jan 17, 2019 6:43 am

Re: "Enabled of menuitem" doesn't work on Windows standalone

Post by cpuandnet » Sun Oct 15, 2023 4:40 pm

The keyword OF is missing between enabled and menuItem. Try:

Code: Select all

set the enabled of menuItem i of button "Some Button Name" to (not demoRunning)
Tim

bd525
Posts: 80
Joined: Sun Aug 31, 2014 12:43 am

Re: "Enabled of menuitem" doesn't work on Windows standalone

Post by bd525 » Sun Oct 15, 2023 4:56 pm

Well, it's embarrassing I didn't see that. The Mac version working fine despite the error misled me into not looking for such a cause.

Alas, though: Fixing the oversight made no difference. The problem still exists on the Windows standalone.

cpuandnet
Posts: 32
Joined: Thu Jan 17, 2019 6:43 am

Re: "Enabled of menuitem" doesn't work on Windows standalone

Post by cpuandnet » Sun Oct 15, 2023 5:45 pm

I haven't used menuItems much but I don't think each menu item has individual properties because they exist in a list. Try changing your code to look something more like this:

Code: Select all

if demoRunning then
   disable menuItem i of button "someButtonName"
else
   enable menuItem i of button "someButtonName"
end if

bd525
Posts: 80
Joined: Sun Aug 31, 2014 12:43 am

Re: "Enabled of menuitem" doesn't work on Windows standalone

Post by bd525 » Sun Oct 15, 2023 6:08 pm

I haven't used menuItems much but I don't think each menu item has individual properties because they exist in a list. Try changing your code to look something more like this:
CODE: SELECT ALL

if demoRunning then
disable menuItem i of button "someButtonName"
else
enable menuItem i of button "someButtonName"
end if
Thanks, but nope, didn't make a difference.

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Re: "Enabled of menuitem" doesn't work on Windows standalone

Post by SparkOut » Sun Oct 15, 2023 9:16 pm

I have tested here on Windows (11) with LC 10.0-dp5 and built a standalone that has two buttons - one is an Option Menu and the other is a Pulldown Menu.

I had another button with the script to toggle the state of the menuItem (looping through the lines of the text of the button).
The action to disable menuItem i of button "OptionMenuTest" inserted "(" before the text of that menuItem but didn't otherwise appear to have an effect on the menu options and the button script answering the menuPick merrily answered the option chosen, whether the "(" was present or not.
The action to disable menuItem i of button "PulldownMenuTest" inserted "(" before the text of that menuItem AND clearly disabled the menu option, with the line greyed out. The button script answering the menuPick merrily answered the option chosen, ONLY if the choice was not disabled.
So, I think the properties are being recorded correctly - but some properties don't apply to certain types of menu buttons.

What style of button are you using?

bd525
Posts: 80
Joined: Sun Aug 31, 2014 12:43 am

Re: "Enabled of menuitem" doesn't work on Windows standalone

Post by bd525 » Sun Oct 15, 2023 11:01 pm

Thanks, Sparkout. I'm using option menus. I tested with a pulldown menu and it worked as advertised. The problem is I don't want to use pulldown menus, which are meant to be used in the menubar. I considered putting my row of menus (see attached) in the menubar but chose not to because for clarity I want both the menu title and the current menu selection for each menu displayed in close proximity to each other. Option menus placed in the app with titles in text fields above work well for that, pulldown menus in the menubar do not.

At this point this problem appears to be a Livecode bug. Disabling option menu items works on Mac, but not on Windows. :-(

I'll keep brainstorming a workaround, but if anybody has insight about a workable approach, or something I'm missing, I'd sure appreciate hearing it.
Attachments
Screenshot.png

Post Reply

Return to “Windows”