"Enabled of menuitem" doesn't work on Windows standalone
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
"Enabled of menuitem" doesn't work on Windows standalone
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?
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?
Re: "Enabled of menuitem" doesn't work on Windows standalone
The keyword OF is missing between enabled and menuItem. Try:
Tim
Code: Select all
set the enabled of menuItem i of button "Some Button Name" to (not demoRunning)
Re: "Enabled of menuitem" doesn't work on Windows standalone
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.
Alas, though: Fixing the oversight made no difference. The problem still exists on the Windows standalone.
Re: "Enabled of menuitem" doesn't work on Windows standalone
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
Re: "Enabled of menuitem" doesn't work on Windows standalone
Thanks, but nope, didn't make a difference.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
Re: "Enabled of menuitem" doesn't work on Windows standalone
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?
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?
Re: "Enabled of menuitem" doesn't work on Windows standalone
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.
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.