ConstructContextualMenu

If I have the following code in a ConstructContextualMenu event, how on earth is the menu still showing if the statement is not true?

[code]

if parentKey = “$keyTables” then
base.Append(new MenuItem(“New Table”))
base.Append(new MenuItem(“Alter”))
base.Append(new MenuItem(“Rename”))
base.Append(new MenuItem(“Delete”))

end if[/code]

I think we’d need to see the whole method. Are you storing the menu into a property? Are you sure the statement is not true, i.e. you walked through it with the debugger?

Thats all the code there is in the event. Yes I have put msgbox just before to check that parentKey is not $keyTables

theres a bug report about this
don’t know the # off the top of my head

[quote=82455:@Norman Palardy]theres a bug report about this
don’t know the # off the top of my head[/quote]

Oh fab, spent 2 night sweating over this.

It works fine (i.e. menu does not show) until the condition is met and then it will show it regardless of whether or not the condition is met. See this very simple example which is looking for you contextual clicking “TestRow2”

Example Code

when you get passed base you MIGHT try just removing all its rows, setting it nil, or assigning a new menu item
I forget what the notes on the case said but there was a workaround

(Xojo: Account Login)]<https://xojo.com/issue/31366>

hmm sounds a lot like 22802 which was supposedly fixed way back when

Definitely not fixed. See my example above.

Also Bug 28142 is similar that I am participating in as well. Once the menu triggers and pops it always stays in that state whether the “condition” is any longer true or not.

BTW - on a PopupMenu, ConstuctContextalMenu is not firing at all. (There was case 10727 ages ago, related?)

No
Popupmenus literally don’t get such an event even from the OS