Purpose Embed an HTML dialog Our example demonstrates a graphical user interface for IW21 notifications (PC hardware malfunction) |
Solution We start by adding pushbuttons on the IW21 screen that will bring up specialized dialogs for car maintenance, car malfunction and PC malfunction:
Link to HTML page:
if not V[IW21_mode]Box (1,53) (8,73) "Special functions" Pushbutton (2,54) "Car maintenance" size=(2,17) process="IW21_start.txt" using MODE = "CAR2" Pushbutton (4,54) "Car malfunction" size=(2,17) process="IW21_start.txt" using MODE = "CAR1" Pushbutton (6,54) "PC malfunction" size=(2,17) process="IW21_start.txt" using MODE = "PC" stop script endif // delete some standard elements del G[Reference] del F[Notification Type] -triple del F[Notification] -triple // offer option to return to standard screen using MODE = "" // PC malfunction
dialog Box (0,0) (29,155) "PC hardware malfunction" Control (0.7,0.8) (28.9,155.4) _ progID="file://C:\GuiXT\Scripts\iw21.pc.html" _ name="control.pc" Pushbutton (30,1) "Save" process="IW21_save.txt" size=(2,16) endif // no action on Enter InutScript "iw21.start.txt": Parameter MODE// Set dialog mode for
IW21 // re-open the
transaction
InutScript "iw21.save.txt": // Create notification with HTML user input // Get user input from HTML page // build up a test message for HTML status Set V[msg] "&V[msg]\nMonitor: &V[status_monitor]" Set V[msg] "&V[msg]\nKeyboard: &V[status_keyboard]" Set V[msg] "&V[msg]\nMouse: &V[status_mouse]" Set V[msg] "&V[msg]\nCamera: &V[status_camera]" Set V[msg] "&V[msg]\nMicrophone: &V[status_microphone]" // display the test message Return JavaScript "html_to_guixt" function html_to_guixt(ie) { // obtain status object from HTML page var status = ie.document.parentWindow.return_status(); // Set GuiXT variable for each status property for (var prop in status) { guixt.Set("status_" + prop, status[prop]); }; };
JavaScript in HTML page "iw21.pc.html" // return status of malfunction report function return_status() { var status = {monitor:"", pc:"", keyboard:"", mouse:"", camera:"", microphone:""}; for (var prop in status) { status[prop] = document.getElementById(prop).value; }; return status; }; |
Components |