RAD Studio |  |

Using IntraWeb with Web Broker and WebSnap

IntraWeb is a powerful tool for developing Web server applications all by itself. Still, there are some things it can't do alone, like create CGI applications. For CGI, you need Web Broker or WebSnap. Also, you may have existing Web Broker and WebSnap applications that you want to extend but not rewrite. You can still take advantage of IntraWeb's design tools by using IntraWeb forms and components in Web Broker or WebSnap projects. You can use IntraWeb to create individual pages instead of entire applications.

To create Web pages using IntraWeb tools, use the following steps:

1. Create or open a Web Broker or WebSnap application, and drop a WebDispatcher component on your Web module (Web Broker) or Web application module (WebSnap). The WebDispatcher component is on the Internet tab of the Tool palette.
2. Drop an IWModuleController component on your Web module (Web Broker) or Web application module (WebSnap). IWModuleController is on the IW Control category of the Tool palette.
3. In WebSnap applications, create a new Web page module if necessary. In the New WebSnap Page dialog, uncheck the New File box in the HTML section before continuing.
   Note: If you create a page module with the New File box checked, you can change the result later. Open the page module's unit file in the editor. Next, change '.html' to an empty string (") in the WebRequestHandler.AddWebModuleFactory call at the bottom of the unit.
4. Remove any existing page producer components from your Web module (Web Broker) or Web page module (WebSnap).
5. Drop an IWPageProducer component on your Web module or Web page module.
6. Select FileNewOtherIntraWebPage Form to create a new IntraWeb page form.
7. Add an OnGetForm event handler by double-clicking the IWPageProducer component on your Web module or Web page module. A new method will appear in the editor window.
8. Connect the IntraWeb form to the Web module or Web page module by adding a line of code to your OnGetForm event handler. The code line should be similar to, if not identical to, the following:

Copy Code

    VForm := TformMain.Create(AWebApplication);

Copy Code

    VForm = TformMain->Create(AWebApplication);

If necessary, change TformMain to the name of your IntraWeb form class. To find the form class name, click on the form. Its name appears next to the form window name in the Object Inspector.

1. In the unit file where you changed the event handler, add IWApplication and IWPageForm to the uses clause. Also, add the unit containing your form.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!