Placing a Browser Control on a Form


The following procedure describes the process of placing the Microsoft Web Browser (shell.explorer) ActiveX control on a form.

  1. Open a form in the Form Editor.

  2. Select the tool shown below from the Toolbox and draw a rectangle on the form. This displays the Insert ActiveX Control dialog.

  3. Select the "Microsoft Web Browser" control and click Insert.

  4. Right click on the ActiveX control and select Properties... .

  5. Note the Object name found on the Setup tab.

  6. Close the ActiveX Properties dialog.

  7. Right click on the form's background and select Events > OnInit.

  8. Assuming that the control's name is activeX1, enter the following Xbasic code.

    DIM w1 as P
    w1 = activeX1.ActiveX.this
    if (url <> "") then
        on error goto w_error
        on error goto 0
    end if
    ui_msg_box("Error","Invalid URL.",UI_STOP_SYMBOL)
  9. Click 'V' to display the Variable Definition dialog.

  10. Define the URL variable and give it a default value.

  11. Drag the URL variable from the Drag Drop list onto the form.

  12. Click the '-' button to place a button on the form.

  13. Label the button "Go" and place the same code shown above under its OnPush event.

  14. Save your work and switch to form view. The form should look something like this:

See Also