Please remember this is a work in progress. Home » Classes

Classes

 

TIWAppForm

 

TIWAppForm = class(TIWForm)

Methods

class procedure SetAsMainForm;

Use this procedure to set your form as the main form of the application. The call to this class method must be done in the initialization section of your IW form unit. The IntraWeb Application Wizard already adds a call to this method to the form created by the wizard.

class procedure SetURL(const aPath: string; const aDocument: string);

Use this class procedure to set a relative ULR and HTML document to be mapped to the IW form. Same as URL Mapping.

The sample code below maps "/green.html" to the TGreenForm, ie, when the user access /green.html the TGreenForm is shown.

  1. type
  2.   TGreenForm = class(TIWAppForm)
  3.     IWLabel1: TIWLabel;
  4.   public
  5.   end;
  6.  
  7. implementation
  8. {$R *.dfm}
  9.  
  10. initialization
  11.   TGreenForm.SetURL('/', 'green.html');
  12.  
  13. end.

class function RequestAuth(aRequest: THttpRequest; var rGroup: string): Boolean; virtual;

Override this class procedure to inform if authorization will be requested when the form is to be rendered if Authorization is active in your application.

  1.   TfrmNewItem = class(TIWAppForm)
  2.     ...
  3.   public
  4.     class function RequestAuth(aRequest: TWebRequest; var rGroup: string): Boolean; override;
  5.   end;
  6.  
  7.     ...
  8.  
  9. class function TfrmNewItem.RequestAuth(aRequest: TWebRequest; var rGroup: string): Boolean;
  10. begin
  11.   // this will make the app request authorization, if no user is logged in
  12.   Result := not Assigned(UserSession.CurrentUser);
  13. end;

Events

OnURLRequest: TOnURLRequest;

Use this event to implement special processment when a IW form is activated through a URL Request (ex: http://www.yoursite.com/green.html). See URL Mapping. You need to include unit IW.Http.Request in your uses clause (interface section).

  1. procedure TGreenForm.IWAppFormURLRequest(aSender: TIWAppForm;
  2.   aRequest: THttpRequest);
  3. begin
  4.   if Pos(aRequest.Referer, '192.168') = 0 then begin
  5.     WebApplication.TerminateAndRedirect('http://www.atozed.com');
  6.   end;
  7. end;
  8.  
  9. initialization
  10.   TGreenForm.SetURL('/', 'green.html');

 

Terms of Use | Privacy Statement © 2002 - 2024 Atozed Software