2.14.11 newHTML


Brief Information

Create an HTML dialog

Additional Information

Minimum Origin Version Required: Origin 2017 SR2

Command Line Usage

1. newHTML;

2. newHTML -dp; \\ use Code Builder's frame as HTML dialog parent.

3. newHTML title:=MyExample cname:=MyEx opj:=0;

4. newHTML resize:=1 dlgw:=500 dlgh:=500;

5. newHTML dlgtype:=1 title:=MyGraphExample cname:=MyGrphEx opj:=1 pgshow:=1 pgname:=MyGraph;

X-Function Execution Options

Please refer to the page for additional option switches when accessing the x-function from script

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Type dlgtype

Input

int

0

HTML dialog type

  • 0: Modal
  • 1: Modaless
Dialog Title title

Input

string

MyHTMLDialog

HTML dialog title

Width dlgw

Input

int

800

Specify the width of the HTML dialog in pixel.

Height dlgh

Input

int

600

Specify the height of the HTML dialog in pixel.

Resizable resize

Input

int

1

Specify whether the HTML dialog could be resizable or not.

Save position and size savesz

Input

int

1

Specify whether dialog size is remembered in registry

Origin C Class Name cname

Input

string

MyHTMLDlg

The name of the user defined HTML dialog class derived from HTMLDlg class.

Show pgshow

Input

int

1

Specify whether to show graph or image in the dialog.

  • 0: Do not show a graph or image in the dialog
No graph or image is shown in the dialog.
  • 1: Show a graph or image in the dialog
A graph or an image is shown on the right of the dialog.
Note:
  1. In HTML file, two containers are created, the left one is for the user defined control, the right one is for the graph or the image.
  2. In CPP file, a graph control is created in the user defined HTML class.
Page Position pgpos

Input

int

1

Position embedded Graph/Image page.

  • 0: Left
  • 1: Right
  • 2: Top
  • 3: Bottom
Page Name pgname

Input

string

Graph1

Specify the graph or image by name.

Origin ojs

Input

int

0

Specify whether use the build-in JavaScript libraries: <Origin EXE folder>\JS\origin.js

jQuery jquery

Input

int

0

Specify whether use the build-in JavaScript libraries: <Origin EXE folder>\JS\jquery-2.js

Write files in project path opj

Input

int

1

Specify whether to write the HTML file and the CPP file in project path.

  • 0: Do not write the files in project path
The HTML file and the CPP file will be saved to the specified folder. You will select this folder in a pop-up file browser.
  • 1: Write the files in project path
The HTML file and the CPP file will be saved to the same path with the current project.
Note:
1. The HTML dialog will be launched if you open this current project again, since a piece of LabTalk scripts will be also added to ProjectEvents.ogs when you create a new HTML dialog with specifying to write the files in the project path.
    if(run.LoadOC("%X\name.cpp", 16) == 0)
	OpenNameDlg; //this is the function to open the HTML dialog
    else
	type "Failed to load %X\name.cpp!";
2. If you start a new project and haven’t saved it yet, the HTML file and the CPP file will be saved in User File Folder.

Description

This X-Function can help you create an HTML dialog easily and quickly. It provides some basic options to design your HTML dialog.
For detail about HTML dialog, see these tutorials.

Examples

  1. New a project, and open Book1.
  2. Highlight Column A and Column B, and then right click to select Fill Column With: Row Numbers in the context menu.
  3. Highlight Column B, and then select Plot > Basic 2D : Line from the Origin menu to create Graph1.
  4. Save the project as MyExample.opj.
  5. Select Window: Script Window from the Origin menu.
  6. Type newHTML –d in Script Window and then hit ENTER to bright up the X-Function dialog.
  7. In the X-Function dialog, change the settings as below and click OK to close the dialog.
    XFDialog1.png
  8. Save the project again and exit Origin.
  9. Go to find MyExample.opj, and then double click to open it.
  10. An HTML dialog will pop up.
    HTMLDialog.png
  11. Click Apply button, an Origin C message box and a website message box will pop up one by one.
    Message1.png
    Message2.png

Related X-Functions