Entry
Delphi: Internet: Intraweb: Application: Create: Simple: How create apartment reservation program?
Oct 8th, 2003 13:47
Knud van Eeden,
-----------------------------------------------------------------------
--- Knud van Eeden - Monday 14 July 2003 - 08:40 pm -------------------
---
Delphi: Internet: Intraweb: Application: Create: Simple: How create
apartment reservation program?
---
Steps: Overview:
1. -start your Delphi
2. -select from menu option
'File->New->'Other'->'tab Intraweb'->'Stand Alone application'
3. -double click on the directory where you want to
store your project
4. -open the form (<SHIFT><F12>, then choose 'FormMain')
5. -put on the form the following components from the 'IWStandard'
palette:
1. listbox (rename it to 'AvailableList',
by clicking on attribute 'Name' in the left panel, and
filling in that new name)
2. listbox (rename it to 'ReserveList')
3. link
(rename it to 'AddLink',
and change 'Caption' to 'Add--->')
4. link
(rename it to 'RemoveLink',
and change 'Caption' to '<---Remove')
5. label (name it 'Available Apartment(s)')
6. label (name it 'Reserved Apartment(s)')
7. label (and rename it to 'CountLabel',
and change the caption to 'X Available Apartment(s)')
6. -add a few apartment names, by clicking on the
'Available' listbox, then in the left panel
on property 'Items', then add one or more lines
with apartment names
(e.g. 'Apartment West End'
'Apartment East End'
'Apartment North End'
'Apartment South End')
7. -Double click on the link 'AddLink' and add the following
text:
PROCIntrawebLinkClickCentral( Sender );
8. -Double click on the link 'RemoveLink' and add the following
text:
PROCIntrawebLinkClickCentral( Sender );
9. -Add the following procedure to the text:
procedure TformMain.PROCIntrawebLinkClickCentral( Sender:
TObject );
var
I: Integer;
Dest: TIWListbox;
Src: TIWListbox;
begin
if Sender = AddLink then begin
Dest := ReserveList;
Src := AvailableList;
end
else begin
Src := ReserveList;
Dest := AvailableList;
end;
for i := Src.Items.Count - 1 downto 0 do begin
if Src.Selected[i] then begin
Dest.Items.Add(Src.Items[i]);
Src.Items.Delete(i);
end;
end;
CountLabel.Caption := IntToStr( AvailableList.Items.Count ) + '
available apartment(s).';
end;
10. Add 'SysUtils' to your 'uses' list
11. So your program should look like the following
(compile it and rename this project to e.g. 'reservation')
12. By clicking on the 'Add' link, you can move reservations
to the 'Reserved' listbox, and by clicking on the
'Remove' link you so move them back.
--- cut here ---------------------------------------------------------
unit IWUnit1;
{PUBDIST}
interface
uses
SysUtils,
IWAppForm, IWApplication, IWTypes, IWCompLabel, IWHTMLControls,
Classes,
Controls, IWControl, IWCompListbox;
type
TformMain = class(TIWAppForm)
AvailableList: TIWListbox;
ReserveList: TIWListbox;
AddLink: TIWLink;
RemoveLink: TIWLink;
IWLabel1: TIWLabel;
IWLabel2: TIWLabel;
CountLabel: TIWLabel;
procedure AddLinkClick(Sender: TObject);
procedure RemoveLinkClick(Sender: TObject);
procedure PROCIntrawebLinkClickCentral( Sender: TObject );
public
end;
implementation
{$R *.dfm}
uses
ServerController;
procedure TformMain.AddLinkClick(Sender: TObject);
begin
PROCIntrawebLinkClickCentral( Sender );
end;
procedure TformMain.RemoveLinkClick(Sender: TObject);
begin
PROCIntrawebLinkClickCentral( Sender );
end;
// --- LIBRARY --- //
procedure TformMain.PROCIntrawebLinkClickCentral( Sender: TObject );
var
I: Integer;
Dest: TIWListbox;
Src: TIWListbox;
begin
if Sender = AddLink then begin
Dest := ReserveList;
Src := AvailableList;
end
else begin
Src := ReserveList;
Dest := AvailableList;
end;
for i := Src.Items.Count - 1 downto 0 do begin
if Src.Selected[i] then begin
Dest.Items.Add(Src.Items[i]);
Src.Items.Delete(i);
end;
end;
CountLabel.Caption := IntToStr( AvailableList.Items.Count ) + '
available apartment(s).';
end;
end.
--- cut here ---------------------------------------------------------
9. After compilation, this will start the Intraweb web server.
Click on the 'execute' button in that window, or menu 'Run'-
>'Execute'.
Or run it by running the reservation.exe file, then typing in your
webbrowser
http://127.0.0.1:<port number>
where the port number is the number as shown in that
Intraweb web server panel, when your program starts.
---
---
Internet: source:
http://www.delphizine.com/productreviews/2002/06/di200206ps_p/di200206p
s_p.asp
---
---
(tested OK in Delphi v7 and Windows XP professional)
---
---
Internet: see also:
Delphi: Internet: Intraweb: Application: Create: What are steps to
create Intraweb application?
http://www.faqts.com/knowledge_base/view.phtml/aid/23243/fid/175
---
Delphi: Internet: Intraweb: Application: Create: What are steps to
create and run ISAPI dll in IIS?
http://www.faqts.com/knowledge_base/view.phtml/aid/23269/fid/175
----------------------------------------------------------------------