Origin C Dialog Builder Examples

Origin includes a number of sample dialogs each demonstrating how to programmatically access one or more controls in a Dialog Builder resource. This section describes how to use Origin and Code Builder to launch any of the Origin C Dialog Builder examples. It also describes how to use Microsoft Visual C++ to open and rebuild any of the example resource files used to construct the dialogs. The steps below use the Origin C Dialog Builder TwoGraphs example for demonstration purposes but all Origin Dialog Builder examples work in a similar manner. The remaining topics in this section describe and provide links to individual Dialog Builder sample dialogs.

Use Origin and Code Builder to launch an example dialog.

  1. If needed start Origin and open Code Builder by clicking the Code Builder toolbar button Origin C Dialog Builder Examples CodeBuilder.png on Origin's Standard toolbar.
  2. Download this zip file, extract it.
  3. Select the File:Open menu item in Code Builder. Browse to unzipped folder, and select any of the Origin C Dialog Builder example subfolders (e.g. \Dialog Builder\Graphs) and open the example source file of type *.C or *.CPP in Code Builder (e.g. TwoGraphs.c). Study the code as desired.
  4. Add the source file (e.g. TwoGraphs.c) to the Code Builder workspace by activating it in the Code Builder Multiple Document Interface (MDI) and then pressing the CTRL+W keys. Select the Tools:Rebuild All menu item in Code Builder to compile and link all the files in the Origin C workspace.
  5. Search in the example source file (e.g. TwoGraphs.c) for a function (e.g. TwoGraphs) containing code that declares an instance of a user-defined class object that encapsulates the example dialog (e.g. CTwoDialog GraphDlg;). The function should also include a statement that launches the example dialog using the Origin C Dialog class DoModal or Create member functions (e.g. GraphDlg.DoModal( GetWindow());).
  6. Copy the name of the Origin C function containing the code described above to the clipboard (e.g. TwoGraphs).
  7. Activate Origin. For the TwoGraphs example only, create and activate an Origin worksheet containing three columns of numeric data. Other example programs will include comments should they require additional setup in Origin.
  8. Open the Script Window by selecting the Origin Window:Script Window menu item. Paste the name of the function (e.g. TwoGraphs) into the Script Window and press the Enter key. The function executes and launches the example dialog (e.g. Graph Controls) shown below.
    Origin C Dialog Builder Examples TwoGraphsDialog.png

Use Microsoft Visual C++ to edit and rebuild an example resource file

  1. Close the example dialog (e.g. Graph Controls) in Origin, close Code Builder, and close Origin.
  2. Start Microsoft Visual C++. Select the File:Open Workspace menu item and select Projects (*.dsp) from the Files of type drop down list in the Open Workspace dialog.
  3. Browse to any of the Dialog Builder example subfolders in the unzipped folder at step 2 (e.g. \Dialog Builder\Graphs\ResDLL) and open an example workspace project file (e.g. Graphs.dsp).
  4. Study (and customize) the Microsoft Visual C++ example project as desired and then select the Microsoft Visual C++ Build:Rebuild All menu item to rebuild the resource creating a new version of the DLL (e.g. \Samples\Dialog Builder\Graphs\Graphs.DLL).
  5. Customize the accompanying Origin C source file to work with your resource changes. Rebuild the Code Builder workspace and run the example again.