Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

How to change DigitalWaveformGraph axis properties from Visual C++

I am trying to use some of your cool Windows Forms controls in a Dialog based MFC application with VS2005 and Measurement Studio 8.0.1.300. I have followed the article "Hosting a Windows Form User Control in an MFC Dialog Box" found in the MSDN library.  I am using a DigitalWaveformGraph control and things have actually gone smoother than I expected. I am able to plot multiple signals, resize, respond to events and change a few of the properties, but I can't figure out how to access the XAxis properties programmatically.

BOOL CMFC01Dlg::OnInitDialog()
{
    CDialog::OnInitDialog();

      int nsignals=14;
      NationalInstruments::DigitalWaveform busPlots(100, nsignals);
      for (int i=0; i<100; i++)
      {
        for (int j=0; j<nsignals; j++)
        {
          busPlots.Signals[j]->States[i] = (NationalInstruments::DigitalState)(rand()/20000);
          busPlots.Signals[j]->Name= "HLDC"+j;
        }
      }
      m_ctrl1->digitalWaveformGraph1->PlotAreaColor = System::Drawing::Color::DarkSlateBlue;
      m_ctrl1->digitalWaveformGraph1->Caption = "Digital Waveform Graph";
      m_ctrl1->digitalWaveformGraph1->PlotHeight = 25;
      m_ctrl1->digitalWaveformGraph1->XAxis->AutoSpacing = true;            //This line gives me the following compile error
//  error C2039: 'AutoSpacing' : is not a member of 'NationalInstruments::UI::DigitalXAxis'
      m_ctrl1->digitalWaveformGraph1->Click += MAKE_DELEGATE(System::EventHandler, OnGraphClick);
      m_ctrl1->digitalWaveformGraph1->PlotWaveform(%busPlots);

    return TRUE;
}

Intellisense doesn't list anything beyond XAxis. How can I access those properties?

Thanks.
0 Kudos
Message 1 of 4
(4,147 Views)
Hi PSevilla,

Taking a look at the example found here:

C:\Program Files\National Instruments\Measurement Studio\VC\Examples\Ui\Graph\Axes

This gives a good starting point for programatically accessing Axis properties in Visual C++.

Let me know if you have any questions on that. Thanks!
Dan Weiland
0 Kudos
Message 2 of 4
(4,130 Views)
Dan,

That example is for a CWGraph, I am using a DigitalWaveformGraph which is a Windows Forms Control. I am trying to take advantage of the new .NET 2.0  controls available in the latest version of Measurement Studio without having to learn C# right away. As I mentioned on my previous posting I have been able to access quite a few of the methods and properties but I can't figure out why I get the compile error shown in the code snippet I attached. As far as I can tell AutoSpacing is a member of XAxis but the compiler says otherwise. I get the same error if I try to access any of the other members of XAxis.
0 Kudos
Message 3 of 4
(4,124 Views)

Hi PSevilla,

Sorry it took this long to respond. We were able to reproduce the issue here with our R&D department.  As far as the intellisense not working after a certain point, this may be an issue with MFC C++. However, even without some of the intellisense working, we were able to get the project to compile fine using the .NET user control inside the MFC dialog.  It appears that you might have been missing the appropriate references. For my main project, I included references to

NationalInstruments.UI
NatioanlInstruments.UI.WindowsForms
Your Dot Net user control
NationalInstruments.Common

After adding these references to the project, we were successful at using the syntax

m_ctrl1->digitalWaveformGraph1->XAxis->AutoSpacing = true;

Hope this helps and once again I apologize for the late response.

Best Regards,

Jonathan N.
National Instruments
0 Kudos
Message 4 of 4
(4,055 Views)