![]() In the program I added a Close button to the main form. You can also hide the secondary form and then display it again, to avoid re-creating it each time (particularly if doing so implies losing the user's editing operations). 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. By closing this page (hiding or destroying it), you re-display the previous page. The last page displayed is on the top of the stack and is displayed in the browser. Procedure TformMain.btnShowGraphicClick(Sender: TObject) Īnotherform := TAnotherForm.Create(WebApplication) Įven if the program calls the Show method, it can be considered like a ShowModal call, because IntraWeb considers visible pages as a stack. Add to this page a few IntraWeb components, as usual, and then add to the main form a button or other control you'll use to show the secondary form (with the reference anotherform stored in a field of the main form): To accomplish this, you first need to add a new IntraWeb page to the application, using the Application Form option on the IntraWeb page of Delphi's New Items dialog box (File ® New ® Other). The core feature of the program is its ability to show a second page. For example, if you set the Required property for a component, if the field is empty the data won't be submitted, and you'll see a JavaScript error message (customizable by setting the descriptive FriendlyName property). This happens because all actions in IntraWeb allow for extra client-side operations, such as validations, checks, and submits. In the previous listing, notice that the linked URL is activated via JavaScript, not with a direct link. Second, I've added an IWURL component to the third column, but you could add any other component (including buttons and edit boxes) to the grid. 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. In addition to the output, there are a few interesting things to notice. ![]() The effect of this code is shown in Figure 21.4. := 'Web Site' // set grid contents for i := 1 to IWGrid1.RowCount - 1 do begin Procedure TformMain.IWAppFormCreate(Sender: TObject) In the example, the grid content is determined at startup (in the OnCreate event handler of the main form): This powerful component allows you to place within an HTML grid both text and other components. The main form of the IWTwoForms example features an IntraWeb grid. This example will also serve as an excuse to delve into some of the source code automatically generated by the IntraWeb application wizard. As you'll see, even in this case, IntraWeb development resembles standard Delphi (or Kylix) development, and is different than most other Internet development libraries. Now let's create an IntraWeb application with a second page. := + 2 Īll the programs you have built so far have had a single page. ![]() Here is the code for a couple of event handlers: procedure TformTree.ExpandAll1Click(Sender: TObject) īegin for i := 0 to - 1 doĮnd procedure TformTree.EnlargeFont1Click(Sender: TObject) At the same time, the menu items allow the program to operate on the menu by expanding or collapsing nodes and changing the font. This component has a lot of JavaScript code to let you expand and collapse nodes directly in the browser (with no need to call back the server). The example's second component is a tree view with a set of predefined nodes. You can see an example of a menu in a browser in Figure 21.3. If the menu items handle the OnClick event in the code, they become links at run time. This handy component makes available in a dynamic menu the content of a standard Delphi menu, by referring its AttachedMenu property to a TMenu component: I've built an example (called IWTree) showcasing the menu and tree view components of IntraWeb but also featuring the creation of a component at run time. I won't list each component and describe its use with an example-I'd rather use some of the components in a few demos and underline the architecture of IntraWeb rather than specific details. For example, if you look at the IW Standard page of Delphi's Component Palette, you'll see an impressive list of core components, from the obvious button, check box, radio button, edit box, list box, memo, and so on to the intriguing tree view, menu, timer, grid, and link components. When you build an IntraWeb application, a number of components are available.
0 Comments
Leave a Reply. |