summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extras/tiopf/demos/Demo_20_ListMediators/frmMain.pas47
-rw-r--r--extras/tiopf/demos/Demo_21_AdrsBook_MGM/contactmanager.pas22
-rw-r--r--extras/tiopf/demos/Demo_21_AdrsBook_MGM/demo_adrsbook_mgm.lpi7
-rw-r--r--extras/tiopf/demos/Demo_21_AdrsBook_MGM/demo_adrsbook_mgm.lpr3
-rw-r--r--extras/tiopf/demos/Demo_21_AdrsBook_MGM/frmcitylist.pas7
-rw-r--r--extras/tiopf/demos/Demo_21_AdrsBook_MGM/frmcontactmaint.pas1
-rw-r--r--extras/tiopf/demos/Demo_21_AdrsBook_MGM/frmcountrylist.pas166
-rw-r--r--extras/tiopf/demos/Demo_21_AdrsBook_MGM/frmmain.pas115
-rw-r--r--extras/tiopf/gui/tiMediators.pas12
-rw-r--r--extras/tiopf/tiOPFfpGUI.lpk5
-rw-r--r--src/gui/gui_memo.pas2
11 files changed, 336 insertions, 51 deletions
diff --git a/extras/tiopf/demos/Demo_20_ListMediators/frmMain.pas b/extras/tiopf/demos/Demo_20_ListMediators/frmMain.pas
index 6a173d98..40c108e5 100644
--- a/extras/tiopf/demos/Demo_20_ListMediators/frmMain.pas
+++ b/extras/tiopf/demos/Demo_20_ListMediators/frmMain.pas
@@ -6,7 +6,8 @@ interface
uses
SysUtils, Classes, gfxbase, fpgfx, gfx_widget, gui_form, gui_button,
- gui_grid, gui_checkbox, gui_panel, gui_listview, Model, tiFormMediator;
+ gui_grid, gui_checkbox, gui_panel, gui_listview, gui_listbox,
+ Model, tiFormMediator, tiMediators;
type
@@ -15,11 +16,13 @@ type
{ The object we will be working with. }
FPersonList: TPersonList;
FMediator: TFormMediator;
+ medCombo: TMediatorComboBoxView;
procedure btnViaCodeChangeClick(Sender: TObject);
procedure btnQuitClicked(Sender: TObject);
procedure btnViaCodeAddClick(Sender: TObject);
procedure btnShowModelClick(Sender: TObject);
+ procedure btnShowDeletedClick(Sender: TObject);
procedure SetupMediators;
public
{@VFD_HEAD_BEGIN: MainForm}
@@ -32,6 +35,8 @@ type
btnName4: TfpgButton;
btnQuit: TfpgButton;
cbName1: TfpgCheckBox;
+ lstName1: TfpgListBox;
+ cbName2: TfpgComboBox;
{@VFD_HEAD_END: MainForm}
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@@ -82,6 +87,14 @@ begin
tiShowString(FPersonList.AsDebugString);
end;
+procedure TMainForm.btnShowDeletedClick(Sender: TObject);
+var
+ med: TMediatorView;
+begin
+ med := FMediator.FindByComponent(grdName1).Mediator;
+ tiShowString(TStringGridMediator(med).SelectedObject.AsDebugString);
+end;
+
procedure TMainForm.SetupMediators;
begin
if not Assigned(FMediator) then
@@ -90,9 +103,12 @@ begin
FMediator.Name := 'DemoFormMediator';
FMediator.AddComposite('Name(150,"Name",<);Age(50,"Age",>);GenderGUI(80,"Gender",|)', grdName1);
// FMediator.AddComposite('Name(150,"Name",<);Age(75,"Age",>);GenderGUI(50,"Gender",|)', lvName1);
+ FMediator.AddProperty('Name', lstName1);
end;
FMediator.Subject := FPersonList;
FMediator.Active := True;
+
+ medCombo := TMediatorComboBoxView.CreateCustom(cbName1, FPerson);
end;
constructor TMainForm.Create(AOwner: TComponent);
@@ -127,7 +143,7 @@ begin
with lvName1 do
begin
Name := 'lvName1';
- SetPosition(8, 52, 292, 220);
+ SetPosition(8, 52, 292, 112);
ShowHeaders := True;
end;
@@ -139,6 +155,7 @@ begin
FontDesc := '#Grid';
HeaderFontDesc := '#GridHeader';
TabOrder := 1;
+ Tag := 99;
end;
pnlName1 := TfpgPanel.Create(self);
@@ -162,6 +179,7 @@ begin
SetPosition(8, 296, 120, 24);
Text := 'Add via Code';
FontDesc := '#Label1';
+ Hint := '';
ImageName := '';
TabOrder := 3;
OnClick := @btnViaCodeAddClick;
@@ -174,6 +192,7 @@ begin
SetPosition(8, 324, 120, 24);
Text := 'Change via Code';
FontDesc := '#Label1';
+ Hint := '';
ImageName := '';
TabOrder := 4;
OnClick := @btnViaCodeChangeClick;
@@ -186,6 +205,7 @@ begin
SetPosition(132, 324, 96, 24);
Text := 'Show Model';
FontDesc := '#Label1';
+ Hint := '';
ImageName := '';
TabOrder := 5;
OnClick := @btnShowModelClick;
@@ -198,8 +218,10 @@ begin
SetPosition(232, 324, 80, 24);
Text := 'Delete';
FontDesc := '#Label1';
+ Hint := '';
ImageName := '';
TabOrder := 6;
+ OnClick := @btnShowDeletedClick;
end;
btnQuit := TfpgButton.Create(self);
@@ -209,6 +231,7 @@ begin
SetPosition(528, 324, 80, 24);
Text := 'Quit';
FontDesc := '#Label1';
+ Hint := '';
ImageName := '';
TabOrder := 7;
OnClick := @btnQuitClicked;
@@ -222,6 +245,25 @@ begin
FontDesc := '#Label1';
TabOrder := 8;
Text := 'Show Deleted';
+ OnClick := @btnShowDeletedClick;
+ end;
+
+ lstName1 := TfpgListBox.Create(self);
+ with lstName1 do
+ begin
+ Name := 'lstName1';
+ SetPosition(8, 168, 228, 120);
+ FontDesc := '#List';
+ TabOrder := 9;
+ end;
+
+ cbName2 := TfpgComboBox.Create(self);
+ with cbName2 do
+ begin
+ Name := 'cbName2';
+ SetPosition(320, 276, 204, 22);
+ FontDesc := '#List';
+ TabOrder := 10;
end;
{@VFD_BODY_END: MainForm}
@@ -230,6 +272,7 @@ end;
initialization
gMediatorManager.RegisterMediator(TStringGridMediator, TtiObjectList);
+// gMediatorManager.RegisterMediator(TListBoxMediator, TPersonList);
// gMediatorManager.RegisterMediator(TListViewMediator, TtiObjectList);
end.
diff --git a/extras/tiopf/demos/Demo_21_AdrsBook_MGM/contactmanager.pas b/extras/tiopf/demos/Demo_21_AdrsBook_MGM/contactmanager.pas
index d9b61a44..1bd34a1c 100644
--- a/extras/tiopf/demos/Demo_21_AdrsBook_MGM/contactmanager.pas
+++ b/extras/tiopf/demos/Demo_21_AdrsBook_MGM/contactmanager.pas
@@ -80,46 +80,67 @@ var
begin
c:= TCity.CreateNew;
c.Name:= 'Somerset West';
+ c.ZIP := '7130';
c.Country:= TCountry(FCountryList.FindByProps(['ISO'], ['za'], True));
FCityList.Add(c);
+
c:= TCity.CreateNew;
c.Name:= 'Cape Town';
+ c.ZIP := '8000';
c.Country:= TCountry(FCountryList.FindByProps(['ISO'], ['za'], True));
FCityList.Add(c);
+
c:= TCity.CreateNew;
c.Name:= 'Pretoria';
+ c.ZIP := '0001';
c.Country:= TCountry(FCountryList.FindByProps(['ISO'], ['za'], True));
FCityList.Add(c);
+
c:= TCity.CreateNew;
c.Name:= 'Durban';
+ c.ZIP := '2000';
c.Country:= TCountry(FCountryList.FindByProps(['ISO'], ['za'], True));
FCityList.Add(c);
+
c:= TCity.CreateNew;
c.Name:= 'London';
+ c.ZIP := 'EC9 5NW';
c.Country:= TCountry(FCountryList.FindByProps(['ISO'], ['gb'], True));
+
FCityList.Add(c);
c:= TCity.CreateNew;
c.Name:= 'Watford';
+ c.ZIP := 'NW9 7BJ';
c.Country:= TCountry(FCountryList.FindByProps(['ISO'], ['gb'], True));
FCityList.Add(c);
+
c:= TCity.CreateNew;
c.Name:= 'Frankfurt';
+ c.ZIP := 'FK2000';
c.Country:= TCountry(FCountryList.FindByProps(['ISO'], ['gr'], True));
FCityList.Add(c);
+
c:= TCity.CreateNew;
c.Name:= 'New York';
+ c.ZIP := 'NY2008';
c.Country:= TCountry(FCountryList.FindByProps(['ISO'], ['us'], True));
FCityList.Add(c);
+
c:= TCity.CreateNew;
c.Name:= 'San Fransisco';
+ c.ZIP := 'SF2500';
c.Country:= TCountry(FCountryList.FindByProps(['ISO'], ['us'], True));
FCityList.Add(c);
+
c:= TCity.CreateNew;
c.Name:= 'Paris';
+ c.ZIP := 'PRS007';
c.Country:= TCountry(FCountryList.FindByProps(['ISO'], ['fr'], True));
FCityList.Add(c);
+
c:= TCity.CreateNew;
c.Name:= 'Big City';
+ c.ZIP := 'BC5 7WN';
c.Country:= TCountry(FCountryList.FindByProps(['ISO'], ['uk'], True));
FCityList.Add(c);
end;
@@ -177,6 +198,7 @@ begin
A.Telephone2:= GenPhone;
C.AddressList.Add(A);
end;
+ C.Comments := 'My name is ' + C.FirstName + '.';
FContactList.Add(C);
end;
end;
diff --git a/extras/tiopf/demos/Demo_21_AdrsBook_MGM/demo_adrsbook_mgm.lpi b/extras/tiopf/demos/Demo_21_AdrsBook_MGM/demo_adrsbook_mgm.lpi
index 3260b2ee..6a4a1600 100644
--- a/extras/tiopf/demos/Demo_21_AdrsBook_MGM/demo_adrsbook_mgm.lpi
+++ b/extras/tiopf/demos/Demo_21_AdrsBook_MGM/demo_adrsbook_mgm.lpi
@@ -32,7 +32,7 @@
<PackageName Value="tiOPFfpGUI"/>
</Item1>
</RequiredPackages>
- <Units Count="7">
+ <Units Count="8">
<Unit0>
<Filename Value="demo_adrsbook_mgm.lpr"/>
<IsPartOfProject Value="True"/>
@@ -68,6 +68,11 @@
<IsPartOfProject Value="True"/>
<UnitName Value="frmCityMaint"/>
</Unit6>
+ <Unit7>
+ <Filename Value="frmcountrylist.pas"/>
+ <IsPartOfProject Value="True"/>
+ <UnitName Value="frmCountryList"/>
+ </Unit7>
</Units>
</ProjectOptions>
<CompilerOptions>
diff --git a/extras/tiopf/demos/Demo_21_AdrsBook_MGM/demo_adrsbook_mgm.lpr b/extras/tiopf/demos/Demo_21_AdrsBook_MGM/demo_adrsbook_mgm.lpr
index aa2ba6e0..c9fe0fff 100644
--- a/extras/tiopf/demos/Demo_21_AdrsBook_MGM/demo_adrsbook_mgm.lpr
+++ b/extras/tiopf/demos/Demo_21_AdrsBook_MGM/demo_adrsbook_mgm.lpr
@@ -6,7 +6,8 @@ uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
- Classes, fpgfx, frmmain, frmcontactmaint, frmCityList, frmcitymaint;
+ Classes, fpgfx, frmmain, frmcontactmaint, frmCityList, frmcitymaint,
+ frmcountrylist;
diff --git a/extras/tiopf/demos/Demo_21_AdrsBook_MGM/frmcitylist.pas b/extras/tiopf/demos/Demo_21_AdrsBook_MGM/frmcitylist.pas
index f29882e5..81a7b415 100644
--- a/extras/tiopf/demos/Demo_21_AdrsBook_MGM/frmcitylist.pas
+++ b/extras/tiopf/demos/Demo_21_AdrsBook_MGM/frmcitylist.pas
@@ -30,7 +30,6 @@ type
procedure btnEditClicked(Sender: TObject);
public
procedure AfterCreate; override;
- procedure AfterConstruction; override;
property Data: TCityList read FData write SetData;
end;
@@ -168,11 +167,5 @@ begin
{@VFD_BODY_END: CityListForm}
end;
-procedure TCityListForm.AfterConstruction;
-begin
- inherited AfterConstruction;
-// SetupMediators;
-end;
-
end.
diff --git a/extras/tiopf/demos/Demo_21_AdrsBook_MGM/frmcontactmaint.pas b/extras/tiopf/demos/Demo_21_AdrsBook_MGM/frmcontactmaint.pas
index 404c9e2c..8a8aeb1c 100644
--- a/extras/tiopf/demos/Demo_21_AdrsBook_MGM/frmcontactmaint.pas
+++ b/extras/tiopf/demos/Demo_21_AdrsBook_MGM/frmcontactmaint.pas
@@ -201,6 +201,7 @@ begin
SetPosition(8, 200, 216, 80);
FontDesc := '#Edit1';
TabOrder := 9;
+ Lines.text := 'Hello';
end;
lblName6 := TfpgLabel.Create(self);
diff --git a/extras/tiopf/demos/Demo_21_AdrsBook_MGM/frmcountrylist.pas b/extras/tiopf/demos/Demo_21_AdrsBook_MGM/frmcountrylist.pas
new file mode 100644
index 00000000..e38f7082
--- /dev/null
+++ b/extras/tiopf/demos/Demo_21_AdrsBook_MGM/frmcountrylist.pas
@@ -0,0 +1,166 @@
+unit frmCountryList;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ SysUtils, Classes, gfxbase, fpgfx, gui_edit,
+ gfx_widget, gui_form, gui_label, gui_button,
+ gui_listbox, gui_memo, gui_combobox, gui_basegrid, gui_grid,
+ gui_dialogs, gui_checkbox, gui_tree, gui_trackbar,
+ gui_progressbar, gui_radiobutton, gui_tab, gui_menu,
+ gui_panel, gui_popupcalendar, gui_gauge,
+ model, tiFormMediator;
+
+type
+
+ TCountryListForm = class(TfpgForm)
+ private
+ {@VFD_HEAD_BEGIN: CountryListForm}
+ bvlName1: TfpgBevel;
+ btnAdd: TfpgButton;
+ btnEdit: TfpgButton;
+ btnDelete: TfpgButton;
+ grdName1: TfpgStringGrid;
+ btnCancel: TfpgButton;
+ {@VFD_HEAD_END: CountryListForm}
+ FData: TCountryList;
+ FMediator: TFormMediator;
+ procedure SetData(const AValue: TCountryList);
+ procedure SetupMediators;
+ procedure btnEditClicked(Sender: TObject);
+ public
+ procedure AfterCreate; override;
+ property Data: TCountryList read FData write SetData;
+ end;
+
+{@VFD_NEWFORM_DECL}
+
+procedure ShowCountries(const AList: TCountryList);
+
+
+implementation
+
+uses
+ tiListMediators{, frmCountryMaint};
+
+
+procedure ShowCountries(const AList: TCountryList);
+var
+ frm: TCountryListForm;
+begin
+ frm := TCountryListForm.Create(nil);
+ try
+ frm.SetData(AList);
+ frm.ShowModal;
+ finally;
+ frm.Free;
+ end;
+end;
+
+{@VFD_NEWFORM_IMPL}
+
+procedure TCountryListForm.SetupMediators;
+begin
+ if not Assigned(FMediator) then
+ begin
+ FMediator := TFormMediator.Create(self);
+ FMediator.AddComposite('ISO(60);Name(110)', grdName1);
+ end;
+ FMediator.Subject := FData;
+ FMediator.Active := True;
+end;
+
+procedure TCountryListForm.btnEditClicked(Sender: TObject);
+begin
+ //
+end;
+
+procedure TCountryListForm.SetData(const AValue: TCountryList);
+begin
+ if FData=AValue then exit;
+ FData:=AValue;
+ SetupMediators;
+end;
+
+procedure TCountryListForm.AfterCreate;
+begin
+ {@VFD_BODY_BEGIN: CountryListForm}
+ Name := 'CountryListForm';
+ SetPosition(412, 278, 421, 315);
+ WindowTitle := 'Country Listing';
+
+ bvlName1 := TfpgBevel.Create(self);
+ with bvlName1 do
+ begin
+ Name := 'bvlName1';
+ SetPosition(0, 0, 420, 36);
+ Anchors := [anLeft,anRight,anTop];
+ Shape := bsSpacer;
+ end;
+
+ btnAdd := TfpgButton.Create(bvlName1);
+ with btnAdd do
+ begin
+ Name := 'btnAdd';
+ SetPosition(12, 4, 52, 24);
+ Text := 'Add';
+ FontDesc := '#Label1';
+ Hint := '';
+ ImageName := '';
+ end;
+
+ btnEdit := TfpgButton.Create(bvlName1);
+ with btnEdit do
+ begin
+ Name := 'btnEdit';
+ SetPosition(68, 4, 52, 24);
+ Text := 'Edit';
+ FontDesc := '#Label1';
+ Hint := '';
+ ImageName := '';
+ TabOrder := 1;
+ OnClick := @btnEditClicked;
+ end;
+
+ btnDelete := TfpgButton.Create(bvlName1);
+ with btnDelete do
+ begin
+ Name := 'btnDelete';
+ SetPosition(124, 4, 52, 24);
+ Text := 'Delete';
+ FontDesc := '#Label1';
+ Hint := '';
+ ImageName := '';
+ TabOrder := 2;
+ end;
+
+ grdName1 := TfpgStringGrid.Create(self);
+ with grdName1 do
+ begin
+ Name := 'grdName1';
+ SetPosition(8, 40, 404, 220);
+ FontDesc := '#Grid';
+ HeaderFontDesc := '#GridHeader';
+ TabOrder := 1;
+ end;
+
+ btnCancel := TfpgButton.Create(self);
+ with btnCancel do
+ begin
+ Name := 'btnCancel';
+ SetPosition(332, 276, 80, 24);
+ Text := 'Cancel';
+ FontDesc := '#Label1';
+ Hint := '';
+ ImageName := '';
+ TabOrder := 2;
+ ModalResult := mrOK;
+ end;
+
+ {@VFD_BODY_END: CountryListForm}
+end;
+
+
+end.
diff --git a/extras/tiopf/demos/Demo_21_AdrsBook_MGM/frmmain.pas b/extras/tiopf/demos/Demo_21_AdrsBook_MGM/frmmain.pas
index 71ed42ca..e373eb90 100644
--- a/extras/tiopf/demos/Demo_21_AdrsBook_MGM/frmmain.pas
+++ b/extras/tiopf/demos/Demo_21_AdrsBook_MGM/frmmain.pas
@@ -7,29 +7,32 @@ interface
uses
SysUtils, Classes, gfxbase, fpgfx, gui_edit,
gfx_widget, gui_form, gui_label, gui_button,
- gui_listbox, gui_memo, gui_combobox, gui_basegrid, gui_grid,
- gui_dialogs, gui_checkbox, gui_tree, gui_trackbar,
- gui_progressbar, gui_radiobutton, gui_tab, gui_menu,
+ gui_basegrid, gui_grid, gui_dialogs, gui_menu,
gui_panel, gui_popupcalendar, gui_gauge, tiFormMediator;
type
-
+ { The main application window }
TMainForm = class(TfpgForm)
private
- FMediator: TFormMediator;
-
{@VFD_HEAD_BEGIN: MainForm}
grdContacts: TfpgStringGrid;
btnAdd: TfpgButton;
btnEdit: TfpgButton;
btnDelete: TfpgButton;
- btnCityList: TfpgButton;
- btnName5: TfpgButton;
+ MainMenu: TfpgMenuBar;
+ miFile: TfpgPopupMenu;
+ miEdit: TfpgPopupMenu;
+ miSystem: TfpgPopupMenu;
{@VFD_HEAD_END: MainForm}
+ FMediator: TFormMediator;
procedure FormShow(Sender: TObject);
procedure SetupMediators;
+ procedure miEditAddClick(Sender: TObject);
procedure miEditEditClick(Sender: TObject);
- procedure btnShowCityList(Sender: TObject);
+ procedure miEditDeleteClick(Sender: TObject);
+ procedure miSystemCityList(Sender: TObject);
+ procedure miSystemCountryList(Sender: TObject);
+ procedure miFileExit(Sender: TObject);
public
procedure AfterCreate; override;
procedure AfterConstruction; override;
@@ -42,7 +45,7 @@ implementation
uses
model, contactmanager, tiListMediators, tiBaseMediator, frmcontactmaint,
- frmcitylist, tiDialogs;
+ frmcitylist, frmcountrylist;
{@VFD_NEWFORM_IMPL}
@@ -56,12 +59,17 @@ begin
if not Assigned(FMediator) then
begin
FMediator := TFormMediator.Create(self);
- FMediator.AddComposite('FirstName;LastName(130);EMail(180);Mobile(130);Comments', grdContacts);
+ FMediator.AddComposite('FirstName;LastName(130);EMail(180);Mobile(130);Comments(200)', grdContacts);
end;
FMediator.Subject := gContactManager.ContactList;
FMediator.Active := True;
end;
+procedure TMainForm.miEditAddClick(Sender: TObject);
+begin
+ //
+end;
+
procedure TMainForm.miEditEditClick(Sender: TObject);
var
c: TContact;
@@ -78,23 +86,39 @@ begin
end;
end;
-procedure TMainForm.btnShowCityList(Sender: TObject);
+procedure TMainForm.miEditDeleteClick(Sender: TObject);
+begin
+ //
+end;
+
+procedure TMainForm.miSystemCityList(Sender: TObject);
begin
ShowCities(gContactManager.CityList);
end;
+procedure TMainForm.miSystemCountryList(Sender: TObject);
+begin
+ ShowCountries(gContactManager.CountryList);
+end;
+
+procedure TMainForm.miFileExit(Sender: TObject);
+begin
+ Close;
+end;
+
procedure TMainForm.AfterCreate;
begin
{@VFD_BODY_BEGIN: MainForm}
Name := 'MainForm';
- SetPosition(373, 273, 708, 456);
+ SetPosition(373, 273, 540, 404);
WindowTitle := 'Demo 21: Address Book Demo using MGM';
grdContacts := TfpgStringGrid.Create(self);
with grdContacts do
begin
Name := 'grdContacts';
- SetPosition(20, 36, 516, 336);
+ SetPosition(12, 56, 516, 336);
+ Anchors := [anLeft,anRight,anTop,anBottom];
FontDesc := '#Grid';
HeaderFontDesc := '#GridHeader';
end;
@@ -103,20 +127,23 @@ begin
with btnAdd do
begin
Name := 'btnAdd';
- SetPosition(572, 48, 80, 24);
+ SetPosition(12, 28, 52, 24);
Text := 'Add';
FontDesc := '#Label1';
+ Hint := '';
ImageName := '';
TabOrder := 1;
+ OnClick := @miEditAddClick;
end;
btnEdit := TfpgButton.Create(self);
with btnEdit do
begin
Name := 'btnEdit';
- SetPosition(572, 76, 80, 24);
+ SetPosition(68, 28, 52, 24);
Text := 'Edit';
FontDesc := '#Label1';
+ Hint := '';
ImageName := '';
TabOrder := 2;
OnClick := @miEditEditClick;
@@ -126,37 +153,56 @@ begin
with btnDelete do
begin
Name := 'btnDelete';
- SetPosition(572, 104, 80, 24);
+ SetPosition(124, 28, 52, 24);
Text := 'Delete';
FontDesc := '#Label1';
+ Hint := '';
ImageName := '';
TabOrder := 3;
+ OnClick := @miEditDeleteClick;
end;
- btnCityList := TfpgButton.Create(self);
- with btnCityList do
+ MainMenu := TfpgMenuBar.Create(self);
+ with MainMenu do
begin
- Name := 'btnCityList';
- SetPosition(576, 164, 80, 24);
- Text := 'City List';
- FontDesc := '#Label1';
- ImageName := '';
- TabOrder := 4;
- OnClick := @btnShowCityList;
+ Name := 'MainMenu';
+ SetPosition(0, 0, 540, 24);
+ Anchors := [anLeft,anRight,anTop];
end;
- btnName5 := TfpgButton.Create(self);
- with btnName5 do
+ miFile := TfpgPopupMenu.Create(self);
+ with miFile do
begin
- Name := 'btnName5';
- SetPosition(576, 192, 80, 24);
- Text := 'Button';
- FontDesc := '#Label1';
- ImageName := '';
- TabOrder := 5;
+ Name := 'miFile';
+ SetPosition(344, 136, 120, 20);
+ AddMenuItem('E&xit', 'Alt+F4', @miFileExit);
+ end;
+
+ miEdit := TfpgPopupMenu.Create(self);
+ with miEdit do
+ begin
+ Name := 'miEdit';
+ SetPosition(344, 156, 120, 20);
+ AddMenuItem('Add Contact', '', @miEditAddClick).Enabled := False;
+ AddMenuItem('Edit Contact', '', @miEditEditClick);
+ AddMenuItem('Delete Contact', '', @miEditDeleteClick).Enabled := False;
+ end;
+
+ miSystem := TfpgPopupMenu.Create(self);
+ with miSystem do
+ begin
+ Name := 'miSystem';
+ SetPosition(344, 176, 120, 20);
+ AddMenuItem('City List', '', @miSystemCityList);
+ AddMenuItem('Country List', '', @miSystemCountryList);
end;
{@VFD_BODY_END: MainForm}
+
+ // setup main menu
+ MainMenu.AddMenuItem('&File', nil).SubMenu := miFile;
+ MainMenu.AddMenuItem('&Edit', nil).SubMenu := miEdit;
+ MainMenu.AddMenuItem('&System', nil).SubMenu := miSystem;
end;
procedure TMainForm.AfterConstruction;
@@ -177,5 +223,6 @@ initialization
gMediatorManager.RegisterMediator(TStringGridMediator, TContactList);
gMediatorManager.RegisterMediator(TListViewMediator, TAddressList);
gMediatorManager.RegisterMediator(TStringGridMediator, TCityList);
+ gMediatorManager.RegisterMediator(TStringGridMediator, TCountryList);
end.
diff --git a/extras/tiopf/gui/tiMediators.pas b/extras/tiopf/gui/tiMediators.pas
index 2825c1f4..e2b11681 100644
--- a/extras/tiopf/gui/tiMediators.pas
+++ b/extras/tiopf/gui/tiMediators.pas
@@ -255,9 +255,9 @@ begin
if Subject.GetFieldBounds(FieldName,Mi,Ma) and (Ma>0) then
FEditControl.MaxLength := Ma;
if ObjectUpdateMoment in [ouOnChange,ouCustom] then
- FeditControl.OnChange := @DoOnChange
+ FEditControl.OnChange := @DoOnChange
else
- FeditControl.OnExit := @DoOnChange;
+ FEditControl.OnExit := @DoOnChange;
end;
procedure TMediatorEditView.SetObjectUpdateMoment(const AValue: TObjectUpdateMoment);
@@ -499,6 +499,14 @@ procedure TMediatorMemoView.SetupGUIandObject;
begin
inherited;
EditControl.Lines.Clear;
+
+ //if UseInternalOnChange then
+ //EditControl.OnChange := @DoOnChange; // default OnChange event handler
+ if ObjectUpdateMoment in [ouOnChange,ouCustom] then
+ FEditControl.OnChange := @DoOnChange
+ else
+ FEditControl.OnExit := @DoOnChange;
+
// EditControl.ScrollBars := ssVertical;
// EditControl.WordWrap := True;
end;
diff --git a/extras/tiopf/tiOPFfpGUI.lpk b/extras/tiopf/tiOPFfpGUI.lpk
index e1dcd750..21e3d157 100644
--- a/extras/tiopf/tiOPFfpGUI.lpk
+++ b/extras/tiopf/tiOPFfpGUI.lpk
@@ -4,14 +4,11 @@
<Name Value="tiOPFfpGUI"/>
<Author Value="Graeme Geldenhuys"/>
<CompilerOptions>
- <Version Value="5"/>
+ <Version Value="8"/>
<SearchPaths>
<OtherUnitFiles Value="gui/"/>
<UnitOutputDirectory Value="../../lib"/>
</SearchPaths>
- <CodeGeneration>
- <Generate Value="Faster"/>
- </CodeGeneration>
<Other>
<CustomOptions Value="-dLINK_CSVx
-dLINK_TABx
diff --git a/src/gui/gui_memo.pas b/src/gui/gui_memo.pas
index 3d160d2a..afd9d4fb 100644
--- a/src/gui/gui_memo.pas
+++ b/src/gui/gui_memo.pas
@@ -109,6 +109,8 @@ type
property TabOrder;
property TextColor;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
+ property OnEnter;
+ property OnExit;
property OnKeyPress;
end;