Page 1 of 1

Items with ( in first character grayed out

Posted: Mon Apr 27, 2015 3:12 pm
by matthellstrom
In both the pulldown menu and option menu, if the first character in one of my choices is a left paren ( the choice is grayed out and unselectable. To test, just set up a new control and change the choices to:

(Choice 1)
Choice 2
(Choice 3)

You'll see that only Choice 2 is able to be selected. This is on a mac, I haven't tested it on a PC.

Also, the ( is missing in the selections for those 2 items.

Re: Items with ( in first character grayed out

Posted: Mon Apr 27, 2015 3:37 pm
by Klaus
Hi Matt,

1. welcome to the forum! :D

2. This is correct behavior!
A left round bracket ( at the beginning of a menuitem indicates that this menuitem is DISABLED, as you have experienced.

You can force the character to appear and be part of your menuitem when you ESCAPE this character with a BACKSLASH.
Then the enigne knows that ( is part of the menuitem!

This should work in your menu:
\(Choice 1)
Choice 2
\(Choice 3)


Best

Klaus

Re: Items with ( in first character grayed out

Posted: Mon Apr 27, 2015 4:06 pm
by matthellstrom
OK great! Thanks!

Re: Items with ( in first character grayed out

Posted: Mon Apr 27, 2015 4:20 pm
by matthellstrom
Next problem is the label for the control has the \ in it. Is there a simple way to avoid that?

Re: Items with ( in first character grayed out

Posted: Mon Apr 27, 2015 4:32 pm
by matthellstrom
OK well I figured out how to do it with a function, but I'm wondering if there is an easier way. Here's what i did:

function corCheckEscape textToCheck
if char 1 to 2 in textToCheck = "\(" then
delete char 1 in textToCheck
end if
return textToCheck
end corCheckEscape

Re: Items with ( in first character grayed out

Posted: Mon Apr 27, 2015 5:07 pm
by Klaus
Hi Matt,

well, you MAY do this shorter with some regular expression, but that is still a complete mystery to me :D
Your function looks great, I would do it this way, too!


Best

Klaus

Re: Items with ( in first character grayed out

Posted: Tue Apr 28, 2015 6:46 pm
by jacque
The documented way to indicate that a character in a menu is a literal instead of a status designator is to double it. (In fact, I wasn't aware of the backslash solution until now.) So if you want to display the first parenthesis, you double it like this:

((Open)

And although it looks strange, to disable it you would add the disabling parenthesis, giving you three:

(((Open)

This works and you get the text you expect in the menuPick parameter without any alterations required. I have to add though that I have never seen a menu item with parentheses and I don't think it's standard behavior.

Re: Items with ( in first character grayed out

Posted: Thu Apr 30, 2015 2:24 pm
by matthellstrom
I didn't see that documentation anywhere. I will try that.

The reason I have a ( in the first character is because that's in the data. It's a list of vendors, and one of them has that in its name. I have to allow for anything, within reason.

Re: Items with ( in first character grayed out

Posted: Thu Apr 30, 2015 5:04 pm
by jacque
I couldn't find it in a quick search of the dictionary either, but it's in there somewhere. The convention dates back to the beginning of time.

If you're working with company names then yes, your approach makes sense now.

Re: Items with ( in first character grayed out

Posted: Thu Apr 30, 2015 6:17 pm
by mwieder
Doubling? Really? :shock:
Learning something new every day.

Re: Items with ( in first character grayed out

Posted: Thu Apr 30, 2015 7:02 pm
by jacque
Okay, I found it in the user guide and I was half wrong but it still works anyway. Here's what it says:
To put an & or / character in the text of a menu, double the characters: && or //.

Putting the ( character anywhere in a line disables the menu item. To put a ( character
in a menu item without disabling it, precede it with a backslash: \(.
So it seems that doubling is only supposed to disable "&" and "/" but it seems to work fine with "(" as well. I've always just doubled all the special characters without any problem. Apparently my brain can only hold one rule at a time.