Welcome
Topic #1.1.1.1.1.
Up To: Programmers
   Read: IDE Highlights  
   >>Web Actions  

to to to to to Web Actions

Browsing >>Web Actions: Writing custom web action components

The WebHub class library includes a class called TwhWebActionEx. It is special for two reasons:
  1. Whatever the component does, that action can be triggered from the web simply by calling its name. If the component is called WebMailForm then WebMailForm.execute from a WebHub page will cause the component to execute/run. In the case of WebMailForm, which is included with WebHub, it will send an email message.
  2. Save-state features are included. So even though there might be a thousand people sharing your custom application in an afternoon, each one of them gets to use the component with their own properties set just the way they require. Examples would be: number of search results returned, graphics preferences, or foreign language translation.

Besides giving you the "base class" for TwhWebActionEx, WebHub also gives you a number of derived components for special purposes. By using these components you save yourself anywhere from hours to weeks of work in implementing special purpose features. Here are some popular examples:

  • TwhdbScan - displays a database-driven HTML table, with scrolling and many other features.
  • TwhMailForm - sends email messages including form letters with surfer data "merged" in.
  • TwhPicture - processes BMP to GIF conversions (a separate license is required from Unisys).
  • TwhDropDown - create HTML drop-down boxes that save-state
  • and many more!


Once you learn to program Web Action components, you have unlocked the power of WebHub. Here is a simple HELLO, WORLD example so you can see the syntax. This code goes on the OnExecute event of the TwhWebActionEx component which has been named waHello in this example.
procedure TfmAppSendStr.waHelloExecute(Sender: TObject);
begin
  inherited;
  with TwhWebAction(Sender).Response do 
  begin
    SendHdr('2','Hello, World!');
    Send('The time is '+DateTimeToStr(now));
  end;
end;

Running: WebHub-v3.270 compiled with d25_win32 on Microsoft-IIS/10.0,
Tue, 21 Nov 2017 00:44:29 UTC
Session 616919005, 0 pages sent to CCBot/2.0 (http://commoncrawl.org/faq/) at 54.81.139.56;
Time to produce this page: 0msec.