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.










share|improve this question
























  • 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















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.










share|improve this question
























  • 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













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.










share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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


















  • 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












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.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    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

























    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.






    share|improve this answer

























      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.






      share|improve this answer























        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.






        share|improve this answer












        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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 8 at 22:36









        VZ.

        14.2k12736




        14.2k12736






























            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            這個網誌中的熱門文章

            Tangent Lines Diagram Along Smooth Curve

            Yusuf al-Mu'taman ibn Hud

            Zucchini