Support #2670
closedDisable Browser's context menu in a WTableView
0%
Description
I'd like to show a custom context menu in a WTableView instead of the browser's menu.
I successfully added a WPopupMenu to the table
m_TableView->mouseWentDown().connect(this, &MyWebApp::HandleTableMouseEvent);
and
void MyWebApp::HandleTableMouseEvent( Wt::WModelIndex index, Wt::WMouseEvent event )
{
if(event.button() == Wt::WMouseEvent::RightButton)
{
auto coord = event.document();
auto pm= new Wt::WpopupMenu();
pm->popup(Wt::WPoint(coord.x,coord.y));
}
}
However, the browser's context menu appears as well when I right click, which is undesired.
I tried the method described in here without success, although it seems to work with other widgets such as the WTreeTableView.
Any idea how I could fix this?
Files
Updated by Koen Deforche over 10 years ago
- Status changed from New to InProgress
- Assignee set to Roel Standaert
- Target version set to 3.3.2
Hey Mike,
We are a little caught up with getting a release out... sorry for the long delay.
And no, this is not a case of RTFM :-)
Regards,
koen
Updated by Roel Standaert over 10 years ago
- File WTableView_DisableContextMenu.cpp WTableView_DisableContextMenu.cpp added
- Status changed from InProgress to Feedback
Hey,
I tested it with the supplied file, and it seems to work fine in all the browsers that I tested. I tested it with Wt 3.3.2 RC2.
Do you have this problem with the example code I supplied? What browser are you using? Is there anything that you do differently?
Regards,
Roel
Updated by Anonymous over 10 years ago
Hey,
I tested the source file you provided with Wt 3.3.1 and the browser context menu showed up as well. (Like the example in my first post)
However, when I run it with Wt 3.3.2 only the custom popup menu shows up. I guess I'll just switch to 3.3.2 .
Thanks for your response!
Cheers,
Mike
Updated by Koen Deforche over 10 years ago
- Status changed from Feedback to Resolved
- Target version set to 3.3.2
Updated by Koen Deforche over 10 years ago
- Status changed from Resolved to Closed