wxWidgets can't receive Right mouse click
up vote
0
down vote
favorite
I'm trying to add a context menu to a grid control in wxWidgets 2.9.4 on Windows 10, and while I can get the context menu key to work right clicking doesn't. Right now I have the following in the header
void handle_contextMenu(wxContextMenuEvent& event);
void handle_rightButton(wxMouseEvent& event);
and in the constructor
Bind(wxEVT_CONTEXT_MENU, &DataGrid::handle_contextMenu, this);
Bind(wxEVT_RIGHT_UP, &DataGrid::handle_rightButton, this);
neither work for the right mouse button.
windows contextmenu wxwidgets
add a comment |
up vote
0
down vote
favorite
I'm trying to add a context menu to a grid control in wxWidgets 2.9.4 on Windows 10, and while I can get the context menu key to work right clicking doesn't. Right now I have the following in the header
void handle_contextMenu(wxContextMenuEvent& event);
void handle_rightButton(wxMouseEvent& event);
and in the constructor
Bind(wxEVT_CONTEXT_MENU, &DataGrid::handle_contextMenu, this);
Bind(wxEVT_RIGHT_UP, &DataGrid::handle_rightButton, this);
neither work for the right mouse button.
windows contextmenu wxwidgets
what type is DataGrid? And why do you want 2 handlers?
– Igor
Nov 8 at 19:42
DataGrid is wxGrid, and I don't actually want 2 handlers, I just want one that works. I've tried both individually, but while the context menu key on the keyboard will work for the first one, the right mouse button doesn't work for either.
– Claudius Turner
Nov 8 at 19:45
1
according to docs.wxwidgets.org/trunk/classwx_grid_event.html, you need wxEVT_GRID_CELL_RIGHT_CLICK.
– Igor
Nov 8 at 20:09
@Igor, thanks that was it. I was looking at generic event handling not realizing that wxGrid had its own events. Make it an answer and I'll accept it.
– Claudius Turner
Nov 8 at 20:32
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm trying to add a context menu to a grid control in wxWidgets 2.9.4 on Windows 10, and while I can get the context menu key to work right clicking doesn't. Right now I have the following in the header
void handle_contextMenu(wxContextMenuEvent& event);
void handle_rightButton(wxMouseEvent& event);
and in the constructor
Bind(wxEVT_CONTEXT_MENU, &DataGrid::handle_contextMenu, this);
Bind(wxEVT_RIGHT_UP, &DataGrid::handle_rightButton, this);
neither work for the right mouse button.
windows contextmenu wxwidgets
I'm trying to add a context menu to a grid control in wxWidgets 2.9.4 on Windows 10, and while I can get the context menu key to work right clicking doesn't. Right now I have the following in the header
void handle_contextMenu(wxContextMenuEvent& event);
void handle_rightButton(wxMouseEvent& event);
and in the constructor
Bind(wxEVT_CONTEXT_MENU, &DataGrid::handle_contextMenu, this);
Bind(wxEVT_RIGHT_UP, &DataGrid::handle_rightButton, this);
neither work for the right mouse button.
windows contextmenu wxwidgets
windows contextmenu wxwidgets
edited Nov 8 at 22:32
VZ.
14.2k12736
14.2k12736
asked Nov 8 at 18:34
Claudius Turner
204
204
what type is DataGrid? And why do you want 2 handlers?
– Igor
Nov 8 at 19:42
DataGrid is wxGrid, and I don't actually want 2 handlers, I just want one that works. I've tried both individually, but while the context menu key on the keyboard will work for the first one, the right mouse button doesn't work for either.
– Claudius Turner
Nov 8 at 19:45
1
according to docs.wxwidgets.org/trunk/classwx_grid_event.html, you need wxEVT_GRID_CELL_RIGHT_CLICK.
– Igor
Nov 8 at 20:09
@Igor, thanks that was it. I was looking at generic event handling not realizing that wxGrid had its own events. Make it an answer and I'll accept it.
– Claudius Turner
Nov 8 at 20:32
add a comment |
what type is DataGrid? And why do you want 2 handlers?
– Igor
Nov 8 at 19:42
DataGrid is wxGrid, and I don't actually want 2 handlers, I just want one that works. I've tried both individually, but while the context menu key on the keyboard will work for the first one, the right mouse button doesn't work for either.
– Claudius Turner
Nov 8 at 19:45
1
according to docs.wxwidgets.org/trunk/classwx_grid_event.html, you need wxEVT_GRID_CELL_RIGHT_CLICK.
– Igor
Nov 8 at 20:09
@Igor, thanks that was it. I was looking at generic event handling not realizing that wxGrid had its own events. Make it an answer and I'll accept it.
– Claudius Turner
Nov 8 at 20:32
what type is DataGrid? And why do you want 2 handlers?
– Igor
Nov 8 at 19:42
what type is DataGrid? And why do you want 2 handlers?
– Igor
Nov 8 at 19:42
DataGrid is wxGrid, and I don't actually want 2 handlers, I just want one that works. I've tried both individually, but while the context menu key on the keyboard will work for the first one, the right mouse button doesn't work for either.
– Claudius Turner
Nov 8 at 19:45
DataGrid is wxGrid, and I don't actually want 2 handlers, I just want one that works. I've tried both individually, but while the context menu key on the keyboard will work for the first one, the right mouse button doesn't work for either.
– Claudius Turner
Nov 8 at 19:45
1
1
according to docs.wxwidgets.org/trunk/classwx_grid_event.html, you need wxEVT_GRID_CELL_RIGHT_CLICK.
– Igor
Nov 8 at 20:09
according to docs.wxwidgets.org/trunk/classwx_grid_event.html, you need wxEVT_GRID_CELL_RIGHT_CLICK.
– Igor
Nov 8 at 20:09
@Igor, thanks that was it. I was looking at generic event handling not realizing that wxGrid had its own events. Make it an answer and I'll accept it.
– Claudius Turner
Nov 8 at 20:32
@Igor, thanks that was it. I was looking at generic event handling not realizing that wxGrid had its own events. Make it an answer and I'll accept it.
– Claudius Turner
Nov 8 at 20:32
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
The reason you can't bind to these events on wxGrid
itself is that it's a composite window as explained in the "Accessors for component windows" section of the documentation. So to make this code work you need to call GetGridWindow()->Bind(...)
, for example.
Alternatively, you could, and probably should, if they're enough, use the higher level events such as the already mentioned wxEVT_GRID_CELL_RIGHT_CLICK
.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
The reason you can't bind to these events on wxGrid
itself is that it's a composite window as explained in the "Accessors for component windows" section of the documentation. So to make this code work you need to call GetGridWindow()->Bind(...)
, for example.
Alternatively, you could, and probably should, if they're enough, use the higher level events such as the already mentioned wxEVT_GRID_CELL_RIGHT_CLICK
.
add a comment |
up vote
1
down vote
accepted
The reason you can't bind to these events on wxGrid
itself is that it's a composite window as explained in the "Accessors for component windows" section of the documentation. So to make this code work you need to call GetGridWindow()->Bind(...)
, for example.
Alternatively, you could, and probably should, if they're enough, use the higher level events such as the already mentioned wxEVT_GRID_CELL_RIGHT_CLICK
.
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
The reason you can't bind to these events on wxGrid
itself is that it's a composite window as explained in the "Accessors for component windows" section of the documentation. So to make this code work you need to call GetGridWindow()->Bind(...)
, for example.
Alternatively, you could, and probably should, if they're enough, use the higher level events such as the already mentioned wxEVT_GRID_CELL_RIGHT_CLICK
.
The reason you can't bind to these events on wxGrid
itself is that it's a composite window as explained in the "Accessors for component windows" section of the documentation. So to make this code work you need to call GetGridWindow()->Bind(...)
, for example.
Alternatively, you could, and probably should, if they're enough, use the higher level events such as the already mentioned wxEVT_GRID_CELL_RIGHT_CLICK
.
answered Nov 8 at 22:36
VZ.
14.2k12736
14.2k12736
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53214094%2fwxwidgets-cant-receive-right-mouse-click%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
what type is DataGrid? And why do you want 2 handlers?
– Igor
Nov 8 at 19:42
DataGrid is wxGrid, and I don't actually want 2 handlers, I just want one that works. I've tried both individually, but while the context menu key on the keyboard will work for the first one, the right mouse button doesn't work for either.
– Claudius Turner
Nov 8 at 19:45
1
according to docs.wxwidgets.org/trunk/classwx_grid_event.html, you need wxEVT_GRID_CELL_RIGHT_CLICK.
– Igor
Nov 8 at 20:09
@Igor, thanks that was it. I was looking at generic event handling not realizing that wxGrid had its own events. Make it an answer and I'll accept it.
– Claudius Turner
Nov 8 at 20:32