|Published (Last):||21 March 2016|
|PDF File Size:||13.7 Mb|
|ePub File Size:||14.29 Mb|
|Price:||Free* [*Free Regsitration Required]|
What s Next? Overview Since Delphi 2 days, Chad Z. Hower has been building a Delphi architecture for simplifying the development of web applications, with the idea of making web programming as simple and as visual as standard Delphi form programming. IntraWeb is intended for this second category of developers, although it is so powerful that even expert web programmers can benefit from its use.
Moreover, IntraWeb components can be used in a specific application, or they can be used in a WebBroker or WebSnap program. My plan is to cover its foundations, so that you can choose whether to use it for your forthcoming projects or for portions of those projects, as it fits best.
For support on IntraWeb, refer to the Borland newsgroups. Note This chapter has had a special review by Chad Z. Hower, a. When not programming, he likes to cycle, kayak, hike, downhill ski, drive, and do just about anything outdoors.
Chad is an American expatriate who currently spends his summers in St. Petersburg, Russia, and his winters in Limassol, Cyprus. Chad can be reached at cpub Hower. Although Delphi 7 is the first version of the Borland IDE to include this set of components, IntraWeb has been around for several years; it has received appraisal and support, including the availability of several third-party components.
IntraWeb is part of the Delphi standard installation now, but it is also available for Kylix. Written with care, IntraWeb applications can be fully cross-platform.
NET version is in the works and will probably become available along with a future Delphi for. NET version. More serious documentation help and PDF files will be available in this 5. When you work with IntraWeb, you think in terms of components, their properties, and their event handlers, as you do in Delphi visual development. To build it, follow these steps: Move to the main form of the program and add to it a button, an edit box, and a list box from the IW Standard page of the Components palette.
Add IWEdit1. The important thing to notice when you run this program is that every time you click the button, the browser sends a new request to the application, which runs the Delphi event handler and produces a new HTML page based on the new status of the components on the form.
The first of these two buttons IWButton2 shows a message using a server-side event, with this Delphi code: procedure TformMain. Items [nItem] else WebApplication. Of course, the effect is rather different, because the application runs in a browser. Doing so should help you understand the effect of setting the component properties and of working with them in general.
This is handy for debugging the application because you can run it from the Delphi IDE and place breakpoints anywhere in the code. You can also use Standalone mode to deploy applications on internal networks intranets and to let users work in offline mode on their own computers, with a web interface. Standalone mode gives you a way to deploy an Application mode IntraWeb program using IntraWeb itself as web server.
Application mode includes session management and all the IntraWeb features and is the preferred way to deploy a scalable application for use on the Web. You can add features to existing programs or rely on other technologies for portions of a dynamic site based on HTML pages, while providing the interactive portions with IntraWeb. Page mode is the only choice for using IntraWeb in CGI applications, but it lacks session-management features.
Items [i]. Thanks to the similarity of IntraWeb components to standard Delphi VCL components, the code is easy to read and understand. The menu has two submenus, which are slightly more complex. The second submenu, Tree Contents, shows a list of the first tree nodes of the main level along with the number of direct subnodes. Count - 1 do Lines. Add IWTreeView1. As an alternative, you can use anchors again working as in the VCL : You can create bottom-right buttons, or components in the middle of the page, with all four anchors set.
See the following demos for examples of this technique. Writing Multipage Applications All the programs you have built so far have had a single page. This example will also serve as an excuse to delve into some of the source code automatically generated by the IntraWeb application wizard. This powerful component allows you to place within an HTML grid both text and other components.
In the example, the grid content is determined at startup in the OnCreate event handler of the main form : procedure TformMain. Cell[0, 0]. Cell[0, 1]. Cell[0, 2]. Cell [i,0]. Cell [i,1]. Create Self ; link. Cell [i,2]. In addition to the output, there are a few interesting things to notice. First, the grid component uses Delphi anchors all set to False to generate code that keeps it centered in the page, even if a user resizes the browser window.
This happens because all actions in IntraWeb allow for extra client-side operations, such as validations, checks, and submits. The core feature of the program is its ability to show a second page.
Create WebApplication ; anotherform. Show; end; Even if the program calls the Show method, it can be considered like a ShowModal call, because IntraWeb considers visible pages as a stack.
The last page displayed is on the top of the stack and is displayed in the browser. By closing this page hiding or destroying it , you re-display the previous page. In the program, the secondary pages closes itself by calling the Release method, which as in the VCL is the proper way to dispose of a currently executing form. Warning In the program I added a Close button to the main form. The demo uses an alternative call: TerminateAndRedirect. The effect, though, is quite similar. The secondary form of the IWTwoForms example shows another interesting feature of IntraWeb: its extensive graphics support.
The form has a graphical component with the classic Delphi Athena image. In this program, the effect is to draw small green circles. This effect is obtained with the following code: procedure Tanotherform.
Canvas; aCanvas. IntraWeb provides predefined session management and simplifies the way you work with sessions. If you need session data for a specific form, all you have to do is add a field to that form. The IntraWeb forms and their components have an instance for each user session. To increase your control over session data and let multiple forms share it, you can customize the TUserSession class that the IntraWeb Application Wizard places in the ServerController unit.
It gives you access to the session data in a thread-safe way: you need to take special care to access it even in a multi-threading environment.
This variable can be used outside of a form or control which are natively session-based , which is why it is primarily used inside data modules, global routines, and non-IntraWeb classes. Data ; end; Because most of this code is generated for you, after adding data to the TUserSession class you simply use it through the UserSession function, as in the following code extracted from the IWSession example.
Creating Http.sys applications with IntraWeb
Creating Http. It listens to such requests coming from TCP stack and forwards them to registered applications. These applications generate complete responses to those requests. One such application is w3wp. Each virtual application created in IIS starts a new w3wp.
Creating a New IntraWeb Application
Execute False ; end. This will make the application to be installed as a Windows Service. If your application installed succesfully, you will see the following dialog. If this dialog does not appear, the service has not been installed.
Subscribe to RSS