Blueprint Help Send comments on this topic.
Final GUI Modifications

Glossary Item Box

Back to Entering Callback Function Code

Final GUI Modifications

The final modifications for the GUI involve calling the Start Interface to trigger the system and to Draw the Pixmap on the display. When getting interface objects from CLIP via the ::Get<name>Ifce() function calls, it is important to check that the interface has been created, since the GUI is started before CLIP and hence a user can press a button before CLIP has created the circuitry.

We also need to define the global function used by the Draw Callback function.

GUIDlg.hpp

class CGUIDlg : public CDialog
{

   ...
};

// *********************************************************** 

void UpdateDisplay( void* Dlg, char* Pixmap, unsigned int FrameCount );

GUIDlg.cpp

...
#include <Base/Infrastructure/Circuitry/MyCircuit_StartIfce.hpp>
...

void CGUIDlg::OnBnClickedButton1()
{
   // start pressed - tell CLIP to start

   // get Ifce from CLIP
   StartIfce* start = ::GetStartIfce();

   // if ifce created
   if ( start != NULL )
   {
      // Signal CLIP
      start->Aux1_StartCsm1Cxn().Signal();

      // disable btn - stop it being pressed again
      StartBtn.EnableWindow( false );
   }
}

...

// *********************************************************** 

void UpdateDisplay( void* Dlg, char* Pixmap, unsigned int FrameCount )
{
   // update pixmap

   ((CGUIDlg*) Dlg)->UpdatePixels( Pixmap, FrameCount );
}

We can now also complete the GetPixmapSize() function

OutputDialog.cpp

...

unsigned int COutputDialog::GetPixmapSize()
{
   return GRID_SIZE*GRID_SIZE*NUM_COLOUR_PLANES;
}

Build and Test