Menu

Set fixed axes limits to Fit (OnFit) mouse command (c++)

Help
Tilen
2020-01-09
2020-01-16
  • Tilen

    Tilen - 2020-01-09

    Hello everyone!

    In my wxPanel, I have inserted two graphs (along with other things). For
    the upper one I did not specify any axes limits (I just used
    mygraph1->Fit();), but for the lower one, I specified axes limits with
    mygraph2->Fit(100,700,0.7,12);.

    This works fine, however, I have one problem: Whenever I right click on the
    lower graph and click Fit, it changes axes limits to standard limits ( not
    the 100,700,0.7,12 that I specified). I realise that this is the
    consequence of the OnFit function in mathplot.cpp (which has just
    written Fit(); inside it, therefore changing graph to standard axes
    limits), but since I am not very good in codewritting, I was not able to
    solve this problem. Since I have only two graphs, solution does not need to
    work for all cases, but just for my specific case.

    Thanks in advance.

     
  • cdron77

    cdron77 - 2020-01-16

    Hello Tilen,

    I believe the best solution for you is to get a pointer to the popup menu item using the method mpWindow::GetPopupMenu()
    http://wxmathplot.sourceforge.net/docs/a00018.html#a552cc32aa4f45c31cfa60ec0dba73ec8
    Using that reference you get a standard wxMenu ( https://docs.wxwidgets.org/3.0/classwx_menu.html ) object, which you can manipulate adding and removing items and their callbacks. THis way you can remove standard "Fit" action and add your own.

    CD_RON77

     

    Last edit: cdron77 2020-01-16

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.