Contextual menu doesn't appear on Xojo R2

I have a webapplication with a weblistbox with a contextual menu.

The project compiled with Xojo 2014 R1.1 works fine.

Same project compiled with Xojo 2014 R2, the contextual menu no longers appears!

Any idea?

What has changed from R1.1 to R2 about weblistbox or contextual menu?

Nothing. Try your project in the 2.1 beta, and if it still occurs, file a bug report with a simple sample app showing the problem.

I’ve already tried in 2.1 beta, but the trouble is the same.

The contextual menu is created by code on CellClick event and, at the end of cell click event, in debug the weblistbox has a contextual menu valued

but with right click into the browser, the menu doesn’t appears.

That doesn’t really surprise me actually. The CellClick event fires on the server after the user right-clicked. You’ve got to create the menu beforehand in a web project.

Like I said, if you still think this is a bug, file a bug report with a small sample project that clearly shows the bug.

Ok. I try to simulate in a small sample project.


The question remains.

Why the same source, compiled with Xojo 2014 R1 works fine.

It might be a bug, but we can’t tell without your sample.

Ok. Now I able to reproduce the trouble. I opened the feedback case 34544 with all necessary info.

I would like to understand if this is bug or not, because the same code on 2014 R1.1 works fine.

There is no difference in the behavior between the two versions.

It works, but only if a row is selected (CellClick doesn’t fire on empty rows). So there is no bug here.

Have you watch the feedback case 34544 and test the attached project? I think, no.

I downloaded the project. No contextual menu at all. Looked at the code. Commented out if ClickType = 2 Then Exit and miracle, the ContextualMenu displays fine with all versions.

Sometimes, the bug is not in Xojo …

This is what happen to me with or without “if ClickType = 2 Then Exit” commented.

I repeat for the umpteenth time: same code with R2014 1.1 works fine.

[quote=113807:@Pietro Beccegato]This is what happen to me with or without “if ClickType = 2 Then Exit” commented.

I repeat for the umpteenth time: same code with R2014 1.1 works fine.[/quote]

CALM DOWN. You may repeat as often as you want. I tried the code you have attached with 2014 R1.1 and it does not work either.

Now, your movie does show some lag.

You have used the code in a very unusual way. Why build the menu in CellClick each time it occurs ? Why get the value of the menu in CellClick ?
Look at for example.

If I rebuild your project according to the rules, building the menu in ListBox.Shown and getting the result in ListBox.ContextualMenuAction, bug gone …

[code]Sub Shown()
Dim menu As New WebMenuItem
menu.Append(New WebMenuItem(str(Microseconds)))
menu.Append(New WebMenuItem(str(Microseconds)))
menu.Append(New WebMenuItem(str(Microseconds)))

me.ContextualMenu = menu
End Sub

[code]Sub ContextualMenuAction(Item As WebMenuItem)
TextArea1.Text = TextArea1.Text + Item.Text + EndOfLine

Dim WD as New WebDialog1
WD.Type = 2
WD.Left = 100
WD.Top = 100
AddHandler WD.Shown, AddressOf Method
End Sub

The content of the ContextualMenu depends on which cell you have clicked on. This is the reason of my code wrote in “unusual way”.

Building the menu in CellClick probably interferes with the code that displays the menu. If the menu is not finished building, Xojo cannot display it.

  • Create menu as WebMenuItem as a WebPage property or module property
  • In Show, instead of Dim, set menu = New WebMenuItem
  • In CellClick, simply change the Text value of the MenuItems like so : menu.Item(0).Text = "test"

If the number of items in the menu change as well, you could set different menus in Shown, or try to remove or add items.