Popup Menu and character &

Hi,
When I do MyPopupMenu.AddRow "Test&01" the & disappear.
Is it normal or a bug ?

Normal as & is used on Windows to denote the keyboard shortcut.

Use && instead.

MyPopupMenu.AddRow “Test&&01”

HA! Beat Axel by 8 whole seconds! :wink:

Markus was faster, he was not blocked today :expressionless:

Ok, thank you very much. It’s the first time I see this problem and I use Xojo since RealBasic.

As the user can add line in PopMenu, if I put it’s entry in NewPopupMenuName can I do :

NewPopupMenuName = Replaceall(NewPopupMenuName, "&", "&&"

But what will happen if the guy want two && ?

If I wan two && “Test&&01”, Have I to enter “Test&&&&01” or “Test&&&01” ?

Thanks a lot for your answer.

Another question, I suppose the problem is the same when I add Menu (in the MenuBar) ?

Why don’t you simply try?

There are problems, and there is lazyness. One of them is frowned upon.

Yes I will give some try. I asked to see if someone already did some tests because there may be have other problems I’ll discover doing my tests.
But I didn’t ask you to do tests for me, I only asked if you known the answer. As you answered not, I will do test.

Thanks for the answer.

Edit : Answer is two & for one. Then “Test&&&&01” -> “Test&&01” . I hope it doesn’t cause any problem.

It’s the same in menu and in Label.
If I put two && to display a single one & , it is still in the text even if not shown (displayed).

As I made a menu with folder name and I call folder from this menu (something like) :

MyItem = MyFolder.Child(MyMenu.Text)

I have to revert the replace :

MyItem = MyFolder.Child(ReplaceAll(MyMenu.Text, "&&", "&"))

Store the FolderItem in the row tag instead of trying to recreate it from the name. Better, store the SaveInfo in case the folder is moved.

Btw, this isn’t a “problem”, it’s a feature.

:smiley:

Thanks for the tips.

But I don’t understand why it’s the same with Label (StaticText). An user can’t select a label, then why add the keyboard shortcut with & ?