Dear all,
I am using plplot 5.13.0 and wxwidgets 3.1.0 in a windows environment,
VS 2017.
I've attempted to merge the plplot wxwidgets example with more complex
wxwidgets examples to generate plots in various frames and panels in a
larger GUI format.
The specific example that produced the figures in this email were made
using wxWidgets uiaction sample (UI action simulator) and the
WxPLplotDemo code.
In a nut shell I've made a splitter window in the main GUI and placed a
copy of one of the plots there via a call to Plot() in the mainframe
definition. The same plot is called for some menu action too.
The issue I am seeing is that the plot in the main GUI does not have
axis labels or tick mark values but the separate plot, activated by the
menu does.
Also, if I refresh the plot in the gui via a separate menu action the
missing data returns.
All calls are to the same function. I'm asking here first since it's
the plot generated by PLplot that is inconsistency but it may be a
wxwidgets issue.
(it is clear that I was messing with other PLplot attributes too, like
subplot, color, etc. This was not the cause of the difference as it is
present regardless.) Modified code is attached (note that the "run
simulation" menu item will cause a crash.), it is a quick hack job but
I'm not seeing an obvious cause for the diff.
This is the main frame GUI
This is the separate plot generated in a new frame.
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
// for all others, include the necessary headers (this file is usually all you
// need because it includes almost all "standard" wxWidgets headers)
#ifndef WX_PRECOMP
#include "wx/wx.h"
#include "wx/log.h"
#include "wx/app.h"
#include "wx/frame.h"
#include "wx/scrolwin.h"
#include "wx/menu.h"
#include "wx/textctrl.h"
#include "wx/textdlg.h"
#endif
#if wxUSE_UIACTIONSIMULATOR
#include "wx/uiaction.h"
#endif
#include "wx/wx.h"
#include "wx/app.h"
#include "wx/frame.h"
#include "wx/scrolwin.h"
#include "wx/menu.h"
#include "wx/textctrl.h"
#include "wx/textdlg.h"
#include "wx/intl.h"
#include "wx/file.h"
#include "wx/log.h"
#include "wx/cmdline.h"
#include "wx/calctrl.h"
#include "wx/splitter.h"
#include "wx/dcmirror.h"
//
// resources
//
// the application icon (under Windows it is in resources and even
// though we could still include the XPM here it would be unused)
#ifndef wxHAS_IMAGES_IN_RESOURCES
#include "../sample.xpm"
#endif
//*
// Cut from wxPLplotDemo
//*
#include "wxPLplotwindow.h"
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define MAX( a, b )( ( a ) < ( b ) ? ( b ) : ( a ) )
#define MIN( a, b )( ( a ) < ( b ) ? ( a ) : ( b ) )
//*
//
// constants
//
// IDs for the controls and the menu commands
enum
{
// menu items
RunSimulation = 1,
SimulateText
};
//
// private classes
//
//*
// Cut from wxPLplotDemo
//*
template< class WXWINDOW >
void Plot(wxPLplotwindow *plotwindow);
class wxPlFrame : public wxPLplotwindow //
{
public:
wxPlFrame(const wxString );
private:
virtual void OnLocate(const PLGraphicsIn );
void OnIdle(wxIdleEvent );
virtual void plot();
bool m_plotted;
};
wxPlFrame::wxPlFrame(const wxString )
{
Create(NULL, wxID_ANY, title);
//give our
frame a nice icon
Connect(wxEVT_IDLE, wxIdleEventHandler(wxPlFrame::OnIdle));
m_plotted = false;
}
void wxPlFrame::OnIdle(wxIdleEvent )
{
//We do our plotting in here, but only the first time it is called
//This allows us to keep checking if the window is ready and only
//plot if it is.
if (!m_plotted && IsReady())
{
m_plotted = true;
plot();
}
}
void wxPlFrame::plot()
{
if (!IsReady())
{
wxMessageBox(wxT("Somehow we attempted to plot before the
wxPLplotwindow was ready. The plot will not be drawn."));
return;
}
wxPLplotstream* pls = GetStream();
PLPLOT_wxLogDebug("wxPlDemoFrame::plot()");
assert(pls);
const size_t np = 500;
PLFLT