|
Windows Form, Book
Create
Windows Form - Book
Classes used in this Form: System.Drawing,
System.Collections, System.ComponentModel, System.Windows.Forms,
System.Data, System.Resources, System.Data.OleDb, System.Configuration,
System.Globalization, BDataSetUnit;
Type of Controls
used in this Form:
OleDbConnection, OleDbDataAdapter, DataSet, Label, Edit, PictureBox,
TextBox, RichTextBox, Button, ListView,
ComboBox and TabControl
- On the File menu ,
click New. and then click Windows Form. New File
name WinForm.pas appears. (Form name - TWinForm)
- On the View menu ,
click Object Inspector. In Object Inspector
modify the following ...
1- WinForm.pas - the File name created
|
Old |
New |
File Name: |
WinForm.pas |
Book.pas | |
2.
TWinForm- Form name created
|
Old |
New |
Caption: Name: Icon: Menu:
Maximizebox: StartPosition: Size: |
WinForm TWinForm (Icon) (none) True
WindowsDefaultLocation 300,300 |
Book TBook (Icon) (none) False
CenterScreen 416,232 | |
Save this
file ... On the
File menu , click Save
The codes
corresponding to the WinForm Form created by system
.... File name - WinForm.pas
unit
WinForm;
interface
uses
System.Drawing, System.Collections, System.ComponentModel,
System.Windows.Forms, System.Data;
type
TWinForm = class(System.Windows.Forms.Form)
{$REGION 'Designer Managed Code'}
strict private
/// <summary>
/// Required designer variable.
/// </summary>
Components: System.ComponentModel.Container;
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
procedure InitializeComponent;
{$ENDREGION}
strict protected
/// <summary>
/// Clean up any resources being used.
/// </summary>
procedure Dispose(Disposing: Boolean); override;
private
{ Private Declarations }
public
constructor Create;
end;
[assembly: RuntimeRequiredAttribute(TypeOf(TWinForm))]
implementation
{$REGION 'Windows Form Designer generated code'}
/// <summary>
/// Required method for Designer support -- do not modify
/// the contents of this method with the code editor.
/// </summary>
procedure TWinForm.InitializeComponent;
begin
Self.Components := System.ComponentModel.Container.Create;
Self.Size := System.Drawing.Size.Create(300, 300);
Self.Text := 'WinForm';
end;
{$ENDREGION}
procedure TWinForm.Dispose(Disposing: Boolean);
begin
if Disposing then
begin
if Components <> nil then
Components.Dispose();
end;
inherited Dispose(Disposing);
end;
constructor TWinForm.Create;
begin
inherited Create;
//
// Required for Windows Form Designer support
//
InitializeComponent;
//
// TODO: Add any constructor code after InitializeComponent
call
//
end;
end | |
1. |
The design,
Book. |
|
|
2. |
From the Tool palette add these
controls .. (From the View menu, click Tool
palette) |
|
- Add the PictureBox
control - PictureBox1, Object
inspector::
Name: Image SizeMode: Visible: |
PictureBox1 System.Drawing.Image...
AutoSixe True | |
- Add the PictureBox
control - PictureBox2, Object
inspector:
Name: Image SizeMode: Visible: |
PictureBox2 System.Drawing.Image...
AutoSixe True | |
- Add the Panel
control - Panel1, Object
inspector:
- Add the OleDbConnection control - OleDbConnection1, Object
inspector:
Represents an open connection to a data
source The OleDbConnection
object of the .NET Framework Data Provider for OLE DB
provides connectivity to data sources exposed using
OLE DB The .NET Framework Data Provider for OLE DB
automatically pools connections using OLE DB session
pooling. Connection string arguments can be used to
enable or disable OLE DB services including
pooling. It is recommended
that you always close the Connection when you
are finished using it
Name: Connection String |
OleDbConnection1
Data Source= ... |
|
Note: Connection info
:
Provider =
Microsoft.Jet.OLEDB.4.0
Data source = C:\App_WFDelphi\pic\KJV2002.mdb
( logical current directory - DataDirectory = C:\App_WFDelphi\pic\
)
- Add the OleDbDataAdapter
control - OleDbDataAdapter1, Object
inspector:
Represents a set of data
commands and a database connection that are used to
fill the DataSet and update the
data source. The OleDbDataAdapter
serves as a bridge between a DataSet and data
source for retrieving and saving data.
Name: InsertCommand1:
CommandText:
CommandTime:
CommandType: Connection: Parameters: SelectCommand:
CommandText:
CommandTime:
CommandType: |
OleDbDataAdapter1 OleDbInsertCommand1 INSERT
INTO BibleTable(Book, BookTitle, Chapter,
TextData, Verse) VALUES (?, ?, ?, ?,
?) 30 Text OleDbConnection1 (Collection) OleDbSelectCommand1
SELECT Book, BookTitle, Chapter, TextData,
Verse , ID FROM BibleTable ORDER BY ID 30 Text |
|
Sytem create the DataSet control
:
at design
time, right-click the OleDbDataAdapter1 control and
choose Generate Dataset. the Generate
Dataset dialog box appears. In this dialog select
New, Type BDAtaSet and then click Ok
System create file name:BDAtaSet.xsd and DataSet control -
BDAtaSet1
- Add the Label
control - lbook , Object
inspector:
Font: Name: Text: TextAlign: |
Times New Roman, 9.75pt,
style=Bold,
Italic lbook Book Left | |
- Add the Label
control - ltitle , Object
inspector:
Font: Name: Text: TextAlign: |
Times New Roman, 9.75pt,
style=Bold,
Italic ltitle Title Left | |
:
- Add the Label
control - lchapter, Object
inspector:
Font: Name: Text: TextAlign: |
Times New Roman, 9.75pt,
style=Bold,
Italic lchapter Chapter Left | |
- Add the Label
control - lverse, Object
inspector:
Font: Name: Text: TextAlign: |
Times New Roman, 9.75pt,
style=Bold,
Italic lverse Verse Left | |
- Add the TextBox control
- txtbook, Object
inspector:
BackColor:
BorderStyle:
Name: |
Control
None
txtbook | |
- Add the TextBox control
- txttitle, Object
inspector:
BackColor:
BorderStyle:
Name: |
Control
None
txttitle | |
- Add the TextBox control
- txtchapter, Object
inspector:
BackColor:
BorderStyle:
Name: |
Control
None
txtchapter | |
- Add the TextBox control
- txtverse, Object
inspector:
BackColor:
BorderStyle:
Name: |
Control
None
txtverse | |
- Add the TextBox control
- txtdatatext, Object
inspector:
BackColor:
BorderStyle:
Multiline: Name: |
ControlLight
Fixed3D
True
txtdatatext | |
- Add the TextBox control
- txtrec, Object
inspector:
BackColor:
BorderStyle:
Name: |
Control
None
txtrec | |
- Add the TButton
control - btnfirst, Object
inspector
- Add the TButton
control - btnprev, Object
inspector
- Add the TButton
control - btnnext, Object
inspector
- Add the TButton
control - btnlast, Object
inspector
- Add the TButton
control - btnclose, Object
inspector
- Add the TabControl
control - TabControl1, Object
inspector
A TabControl
contains tab pages, which are represented by TabPage
objects
Name :
TabPage: |
TabControl1 (Collection) | |
To add a new page to a TabControl control at design
time, right-click the TabControl control and
choose Add Tab. (Gets
the collection of tab pages in this tab control.)
1. |
Add the TabPage control - TabPage1, Object
inspector |
|
Name :
Text : |
TabPage1
Search by Word | | |
|
|
2. |
Add the TabPage control - TabPage2, Object
inspector |
|
Name :
Text : |
TabPage1
Search by Address | | |
|
|
- Add the Label
control - lword , Object
inspector:
Font: Name: Text: TextAlign: |
Times New Roman, 9.75pt,
style=Bold, Italic lword Type in the word
to search
for: Left | |
- Add the RichTextBox control
- RichTData, Object
inspector:
Visible:
Name: |
False RichTData |
|
- Add the TextBox control
- txtword, Object
inspector:
BackColor:
BorderStyle:
Name: |
Window Fixed3D txtword | |
- Add the TextBox control
- txtinfo, Object
inspector:
BackColor:
BorderStyle:
Name: |
Control
None
txtinfo | |
- Add the TButton
control - btndisplay, Object
inspector:
Text: Name: |
Display btndisplay | |
- Add the ListView
control - ListView1, Object
inspector:
AllowColumnReorder
FullRowSelect :
GridLines :
LabelEdit :
MultiSelect :
Name :
View : |
True
True
True
True
False
ListView1
Details | |
- Add the Label
control - lbook1, Object
inspector:
Font: Name: Text: TextAlign: |
Times New Roman, 9.75pt,
style=Bold,
Italic lbook1 Book Left | |
- Add the Label
control - ltitle1, Object
inspector::
Font: Name: Text: TextAlign: |
Times New Roman, 9.75pt,
style=Bold,
Italic ltitle1 Title Left | |
- Add the Label
control - lchapter, Object
inspector:
Font: Name: Text: TextAlign: |
Times New Roman, 9.75pt,
style=Bold,
Italic lchapter1 chapter Left | |
- Add the Label
control - lverse1, Object
inspector:
Font: Name: Text: TextAlign: |
Times New Roman, 9.75pt,
style=Bold,
Italic lverse1 Verse Left | |
- Add the ComboBox
control - cmbbook, Object
inspector:
- Add the ComboBox
control - cmbtitle, Object
inspector:
- Add the ComboBox
control - cmbchapter, Object
inspector:
- Add the ComboBox
control - cmbverse, Object
inspector:
- Add the ComboBox
control - cmbbook1, Object
inspector:
- Add the ComboBox
control - cmbtitle1, Object
inspector:
- Add the ComboBox
control - cmbchapter1, Object
inspector:
- Add the ComboBox
control - cmbverse1, Object
inspector:
| | |
|
The Event and
codes in Delphi ... Book
The text Code is
Navy color, corresponding to code create by
system The
text
Code
is red color, corresponding to the code corresponding to the
events added The text Code is Navy
color,
corresponding to the other form to be
add
|
|
unit
Book;
interface
uses
System.Drawing, System.Collections, System.ComponentModel,
System.Windows.Forms, System.Data, System.Resources,
System.Data.OleDb,
System.Configuration, System.Globalization, BDataSetUnit;
type
TBook = class(System.Windows.Forms.Form)
{$REGION 'Designer Managed Code'}
strict private
/// <summary>
/// Required designer variable.
/// </summary>
components: System.ComponentModel.IContainer;
PictureBox1: System.Windows.Forms.PictureBox;
PictureBox2: System.Windows.Forms.PictureBox;
Panel1: System.Windows.Forms.Panel;
TabControl1: System.Windows.Forms.TabControl;
TabPage1: System.Windows.Forms.TabPage;
TabPage2: System.Windows.Forms.TabPage;
lbook: System.Windows.Forms.Label;
ltitle: System.Windows.Forms.Label;
lchapter: System.Windows.Forms.Label;
lverse: System.Windows.Forms.Label;
txtbook: System.Windows.Forms.TextBox;
txtchapter: System.Windows.Forms.TextBox;
txtverse: System.Windows.Forms.TextBox;
txttitle: System.Windows.Forms.TextBox;
txtdatatext: System.Windows.Forms.TextBox;
txtrec: System.Windows.Forms.TextBox;
btnfirst: System.Windows.Forms.Button;
btnprev: System.Windows.Forms.Button;
btnnext: System.Windows.Forms.Button;
btnlast: System.Windows.Forms.Button;
btnclose: System.Windows.Forms.Button;
ltitle1: System.Windows.Forms.Label;
lbook1: System.Windows.Forms.Label;
lchapter1: System.Windows.Forms.Label;
lverse1: System.Windows.Forms.Label;
cmbbook: System.Windows.Forms.ComboBox;
cmbtitle: System.Windows.Forms.ComboBox;
cmbchapter: System.Windows.Forms.ComboBox;
cmbverse: System.Windows.Forms.ComboBox;
lword: System.Windows.Forms.Label;
txtword: System.Windows.Forms.TextBox;
btndisplay: System.Windows.Forms.Button;
txtinfo: System.Windows.Forms.TextBox;
OleDbConnection1: System.Data.OleDb.OleDbConnection;
oleDbSelectCommand1: System.Data.OleDb.OleDbCommand;
oleDbInsertCommand1: System.Data.OleDb.OleDbCommand;
oleDbUpdateCommand1: System.Data.OleDb.OleDbCommand;
oleDbDeleteCommand1: System.Data.OleDb.OleDbCommand;
OleDbDataAdapter1: System.Data.OleDb.OleDbDataAdapter;
BDataSet1: BDataSetUnit.BDataSet;
ListView1: System.Windows.Forms.ListView;
RichTData: System.Windows.Forms.RichTextBox;
cmbverse1: System.Windows.Forms.ComboBox;
cmbchapter1: System.Windows.Forms.ComboBox;
cmbtitle1: System.Windows.Forms.ComboBox;
cmbbook1: System.Windows.Forms.ComboBox;
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
procedure InitializeComponent;
procedure btnfirst_Click(sender: System.Object; e:
System.EventArgs);
procedure btnprev_Click(sender: System.Object; e:
System.EventArgs);
procedure btnnext_Click(sender: System.Object; e:
System.EventArgs);
procedure btnlast_Click(sender: System.Object; e:
System.EventArgs);
procedure btnclose_Click(sender: System.Object; e:
System.EventArgs);
procedure txtword_KeyPress(sender: System.Object; e:
System.Windows.Forms.KeyPressEventArgs);
procedure btndisplay_Click(sender: System.Object; e:
System.EventArgs);
procedure btndisplay_Enter(sender: System.Object; e:
System.EventArgs);
procedure ListView1_Click(sender: System.Object; e:
System.EventArgs);
procedure cmbbook_SelectedIndexChanged(sender:
System.Object; e: System.EventArgs);
procedure cmbtitle_SelectedIndexChanged(sender:
System.Object; e: System.EventArgs);
procedure cmbchapter_SelectedIndexChanged(sender:
System.Object; e: System.EventArgs);
procedure cmbverse_SelectedIndexChanged(sender:
System.Object; e: System.EventArgs);
procedure TBook_Closed(sender: System.Object; e:
System.EventArgs);
{$ENDREGION}
strict protected
/// <summary>
/// Clean up any resources being used.
/// </summary>
procedure Dispose(Disposing: Boolean); override;
private
{ Private Declarations }
procedure LoadBDataSet;
procedure SetSRecData(NRec : Integer);
public
constructor Create;
class function Showbook:
System.Windows.Forms.DialogResult;
end;
[assembly: RuntimeRequiredAttribute(TypeOf(TBook))]
implementation
uses
MainForm;
var
VRecno : Integer;
{$REGION 'Windows Form Designer generated code'}
/// <summary>
/// Required method for Designer support -- do not modify
/// the contents of this method with the code editor.
/// </summary>
procedure TBook.InitializeComponent;
var
resources: System.Resources.ResourceManager;
begin
resources :=
System.Resources.ResourceManager.Create(TypeOf(TBook));
Self.PictureBox1 :=
System.Windows.Forms.PictureBox.Create;
Self.PictureBox2 :=
System.Windows.Forms.PictureBox.Create;
Self.Panel1 := System.Windows.Forms.Panel.Create;
Self.TabControl1 :=
System.Windows.Forms.TabControl.Create;
Self.TabPage1 := System.Windows.Forms.TabPage.Create;
Self.ListView1 := System.Windows.Forms.ListView.Create;
Self.btndisplay := System.Windows.Forms.Button.Create;
Self.txtword := System.Windows.Forms.TextBox.Create;
Self.lword := System.Windows.Forms.Label.Create;
Self.txtinfo := System.Windows.Forms.TextBox.Create;
Self.TabPage2 := System.Windows.Forms.TabPage.Create;
Self.cmbverse1 := System.Windows.Forms.ComboBox.Create;
Self.cmbchapter1 := System.Windows.Forms.ComboBox.Create;
Self.cmbtitle1 := System.Windows.Forms.ComboBox.Create;
Self.cmbbook1 := System.Windows.Forms.ComboBox.Create;
Self.cmbverse := System.Windows.Forms.ComboBox.Create;
Self.cmbchapter := System.Windows.Forms.ComboBox.Create;
Self.cmbtitle := System.Windows.Forms.ComboBox.Create;
Self.cmbbook := System.Windows.Forms.ComboBox.Create;
Self.lverse1 := System.Windows.Forms.Label.Create;
Self.lchapter1 := System.Windows.Forms.Label.Create;
Self.lbook1 := System.Windows.Forms.Label.Create;
Self.ltitle1 := System.Windows.Forms.Label.Create;
Self.lbook := System.Windows.Forms.Label.Create;
Self.ltitle := System.Windows.Forms.Label.Create;
Self.lchapter := System.Windows.Forms.Label.Create;
Self.lverse := System.Windows.Forms.Label.Create;
Self.txtbook := System.Windows.Forms.TextBox.Create;
Self.txtchapter := System.Windows.Forms.TextBox.Create;
Self.txtverse := System.Windows.Forms.TextBox.Create;
Self.txttitle := System.Windows.Forms.TextBox.Create;
Self.txtdatatext := System.Windows.Forms.TextBox.Create;
Self.txtrec := System.Windows.Forms.TextBox.Create;
Self.btnfirst := System.Windows.Forms.Button.Create;
Self.btnprev := System.Windows.Forms.Button.Create;
Self.btnnext := System.Windows.Forms.Button.Create;
Self.btnlast := System.Windows.Forms.Button.Create;
Self.btnclose := System.Windows.Forms.Button.Create;
Self.OleDbConnection1 :=
System.Data.OleDb.OleDbConnection.Create;
Self.oleDbSelectCommand1 :=
System.Data.OleDb.OleDbCommand.Create;
Self.oleDbInsertCommand1 :=
System.Data.OleDb.OleDbCommand.Create;
Self.oleDbUpdateCommand1 :=
System.Data.OleDb.OleDbCommand.Create;
Self.oleDbDeleteCommand1 :=
System.Data.OleDb.OleDbCommand.Create;
Self.OleDbDataAdapter1 :=
System.Data.OleDb.OleDbDataAdapter.Create;
Self.BDataSet1 := BDataSetUnit.BDataSet.Create;
Self.RichTData := System.Windows.Forms.RichTextBox.Create;
Self.TabControl1.SuspendLayout;
Self.TabPage1.SuspendLayout;
Self.TabPage2.SuspendLayout;
(System.ComponentModel.ISupportInitialize(Self.BDataSet1)).BeginInit;
Self.SuspendLayout;
//
// PictureBox1
//
Self.PictureBox1.Image :=
(System.Drawing.Image(resources.GetObject('PictureBox1.Image')));
Self.PictureBox1.Location :=
System.Drawing.Point.Create(32, 16);
Self.PictureBox1.Name := 'PictureBox1';
Self.PictureBox1.Size := System.Drawing.Size.Create(262,
201);
Self.PictureBox1.SizeMode :=
System.Windows.Forms.PictureBoxSizeMode.AutoSize;
Self.PictureBox1.TabIndex := 0;
Self.PictureBox1.TabStop := False;
//
// PictureBox2
//
Self.PictureBox2.Image :=
(System.Drawing.Image(resources.GetObject('PictureBox2.Image')));
Self.PictureBox2.Location :=
System.Drawing.Point.Create(392, 16);
Self.PictureBox2.Name := 'PictureBox2';
Self.PictureBox2.Size := System.Drawing.Size.Create(221,
201);
Self.PictureBox2.SizeMode :=
System.Windows.Forms.PictureBoxSizeMode.AutoSize;
Self.PictureBox2.TabIndex := 1;
Self.PictureBox2.TabStop := False;
//
// Panel1
//
Self.Panel1.BackColor :=
System.Drawing.SystemColors.InactiveCaption;
Self.Panel1.Location := System.Drawing.Point.Create(328,
0);
Self.Panel1.Name := 'Panel1';
Self.Panel1.Size := System.Drawing.Size.Create(8, 480);
Self.Panel1.TabIndex := 2;
//
// TabControl1
//
Self.TabControl1.Controls.Add(Self.TabPage1);
Self.TabControl1.Controls.Add(Self.TabPage2);
Self.TabControl1.Location :=
System.Drawing.Point.Create(344, 232);
Self.TabControl1.Name := 'TabControl1';
Self.TabControl1.SelectedIndex := 0;
Self.TabControl1.Size := System.Drawing.Size.Create(312,
240);
Self.TabControl1.TabIndex := 3;
//
// TabPage1
//
Self.TabPage1.Controls.Add(Self.ListView1);
Self.TabPage1.Controls.Add(Self.btndisplay);
Self.TabPage1.Controls.Add(Self.txtword);
Self.TabPage1.Controls.Add(Self.lword);
Self.TabPage1.Controls.Add(Self.txtinfo);
Self.TabPage1.Font := System.Drawing.Font.Create('Times
New Roman', 9,
(System.Drawing.FontStyle((System.Drawing.FontStyle.Bold
or System.Drawing.FontStyle.Italic))),
System.Drawing.GraphicsUnit.Point,
(Byte(178)));
Self.TabPage1.Location := System.Drawing.Point.Create(4,
22);
Self.TabPage1.Name := 'TabPage1';
Self.TabPage1.Size := System.Drawing.Size.Create(304,
214);
Self.TabPage1.TabIndex := 0;
Self.TabPage1.Text := 'Search by Word ';
//
// ListView1
//
Self.ListView1.AllowColumnReorder := True;
Self.ListView1.Font := System.Drawing.Font.Create('Times
New Roman', 9, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.ListView1.FullRowSelect := True;
Self.ListView1.GridLines := True;
Self.ListView1.LabelEdit := True;
Self.ListView1.Location := System.Drawing.Point.Create(16,
56);
Self.ListView1.MultiSelect := False;
Self.ListView1.Name := 'ListView1';
Self.ListView1.Size := System.Drawing.Size.Create(280,
136);
Self.ListView1.TabIndex := 20;
Self.ListView1.View := System.Windows.Forms.View.Details;
Include(Self.ListView1.Click, Self.ListView1_Click);
//
// btndisplay
//
Self.btndisplay.Font := System.Drawing.Font.Create('Times
New Roman', 9, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.btndisplay.Location :=
System.Drawing.Point.Create(216, 24);
Self.btndisplay.Name := 'btndisplay';
Self.btndisplay.Size := System.Drawing.Size.Create(72,
24);
Self.btndisplay.TabIndex := 2;
Self.btndisplay.Text := 'Display';
Include(Self.btndisplay.Click, Self.btndisplay_Click);
Include(Self.btndisplay.Enter, Self.btndisplay_Enter);
//
// txtword
//
Self.txtword.Font := System.Drawing.Font.Create('Times New
Roman', 9, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.txtword.Location := System.Drawing.Point.Create(16,
24);
Self.txtword.Name := 'txtword';
Self.txtword.Size := System.Drawing.Size.Create(184, 21);
Self.txtword.TabIndex := 1;
Self.txtword.Text := '';
Include(Self.txtword.KeyPress, Self.txtword_KeyPress);
//
// lword
//
Self.lword.Location := System.Drawing.Point.Create(16, 8);
Self.lword.Name := 'lword';
Self.lword.Size := System.Drawing.Size.Create(160, 16);
Self.lword.TabIndex := 0;
Self.lword.Text := 'Type in the word to search for:';
//
// txtinfo
//
Self.txtinfo.BackColor :=
System.Drawing.SystemColors.Control;
Self.txtinfo.BorderStyle :=
System.Windows.Forms.BorderStyle.None;
Self.txtinfo.Font := System.Drawing.Font.Create('Times New
Roman', 9, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.txtinfo.Location := System.Drawing.Point.Create(16,
192);
Self.txtinfo.Name := 'txtinfo';
Self.txtinfo.Size := System.Drawing.Size.Create(264, 14);
Self.txtinfo.TabIndex := 19;
Self.txtinfo.Text := '';
//
// TabPage2
//
Self.TabPage2.Controls.Add(Self.cmbverse1);
Self.TabPage2.Controls.Add(Self.cmbchapter1);
Self.TabPage2.Controls.Add(Self.cmbtitle1);
Self.TabPage2.Controls.Add(Self.cmbbook1);
Self.TabPage2.Controls.Add(Self.cmbverse);
Self.TabPage2.Controls.Add(Self.cmbchapter);
Self.TabPage2.Controls.Add(Self.cmbtitle);
Self.TabPage2.Controls.Add(Self.cmbbook);
Self.TabPage2.Controls.Add(Self.lverse1);
Self.TabPage2.Controls.Add(Self.lchapter1);
Self.TabPage2.Controls.Add(Self.lbook1);
Self.TabPage2.Controls.Add(Self.ltitle1);
Self.TabPage2.Font := System.Drawing.Font.Create('Times
New Roman', 8.25,
(System.Drawing.FontStyle((System.Drawing.FontStyle.Bold
or System.Drawing.FontStyle.Italic))),
System.Drawing.GraphicsUnit.Point,
(Byte(178)));
Self.TabPage2.Location := System.Drawing.Point.Create(4,
22);
Self.TabPage2.Name := 'TabPage2';
Self.TabPage2.Size := System.Drawing.Size.Create(304,
214);
Self.TabPage2.TabIndex := 1;
Self.TabPage2.Text := 'Search by Address ';
//
// cmbverse1
//
Self.cmbverse1.Font := System.Drawing.Font.Create('Times
New Roman', 9, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.cmbverse1.Location :=
System.Drawing.Point.Create(256, 152);
Self.cmbverse1.Name := 'cmbverse1';
Self.cmbverse1.Size := System.Drawing.Size.Create(40, 23);
Self.cmbverse1.TabIndex := 18;
Self.cmbverse1.Visible := False;
//
// cmbchapter1
//
Self.cmbchapter1.Font := System.Drawing.Font.Create('Times
New Roman', 9, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.cmbchapter1.Location :=
System.Drawing.Point.Create(256, 112);
Self.cmbchapter1.Name := 'cmbchapter1';
Self.cmbchapter1.Size := System.Drawing.Size.Create(40,
23);
Self.cmbchapter1.TabIndex := 17;
Self.cmbchapter1.Visible := False;
//
// cmbtitle1
//
Self.cmbtitle1.Font := System.Drawing.Font.Create('Times
New Roman', 9, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.cmbtitle1.Location :=
System.Drawing.Point.Create(256, 72);
Self.cmbtitle1.Name := 'cmbtitle1';
Self.cmbtitle1.Size := System.Drawing.Size.Create(40, 23);
Self.cmbtitle1.TabIndex := 16;
Self.cmbtitle1.Visible := False;
//
// cmbbook1
//
Self.cmbbook1.Font := System.Drawing.Font.Create('Times
New Roman', 9, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.cmbbook1.Location := System.Drawing.Point.Create(256,
32);
Self.cmbbook1.Name := 'cmbbook1';
Self.cmbbook1.Size := System.Drawing.Size.Create(40, 23);
Self.cmbbook1.TabIndex := 15;
Self.cmbbook1.Visible := False;
//
// cmbverse
//
Self.cmbverse.Font := System.Drawing.Font.Create('Times
New Roman', 9, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.cmbverse.Location := System.Drawing.Point.Create(112,
152);
Self.cmbverse.Name := 'cmbverse';
Self.cmbverse.Size := System.Drawing.Size.Create(136, 23);
Self.cmbverse.TabIndex := 14;
Include(Self.cmbverse.SelectedIndexChanged,
Self.cmbverse_SelectedIndexChanged);
//
// cmbchapter
//
Self.cmbchapter.Font := System.Drawing.Font.Create('Times
New Roman', 9, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.cmbchapter.Location :=
System.Drawing.Point.Create(112, 112);
Self.cmbchapter.Name := 'cmbchapter';
Self.cmbchapter.Size := System.Drawing.Size.Create(136,
23);
Self.cmbchapter.TabIndex := 13;
Include(Self.cmbchapter.SelectedIndexChanged,
Self.cmbchapter_SelectedIndexChanged);
//
// cmbtitle
//
Self.cmbtitle.Font := System.Drawing.Font.Create('Times
New Roman', 9, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.cmbtitle.Location := System.Drawing.Point.Create(112,
72);
Self.cmbtitle.Name := 'cmbtitle';
Self.cmbtitle.Size := System.Drawing.Size.Create(136, 23);
Self.cmbtitle.TabIndex := 12;
Include(Self.cmbtitle.SelectedIndexChanged,
Self.cmbtitle_SelectedIndexChanged);
//
// cmbbook
//
Self.cmbbook.Font := System.Drawing.Font.Create('Times New
Roman', 9, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.cmbbook.Location := System.Drawing.Point.Create(112,
32);
Self.cmbbook.Name := 'cmbbook';
Self.cmbbook.Size := System.Drawing.Size.Create(136, 23);
Self.cmbbook.TabIndex := 11;
Include(Self.cmbbook.SelectedIndexChanged,
Self.cmbbook_SelectedIndexChanged);
//
// lverse1
//
Self.lverse1.Font := System.Drawing.Font.Create('Times New
Roman', 9, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.lverse1.Location := System.Drawing.Point.Create(48,
160);
Self.lverse1.Name := 'lverse1';
Self.lverse1.Size := System.Drawing.Size.Create(56, 16);
Self.lverse1.TabIndex := 10;
Self.lverse1.Text := 'Verse :';
//
// lchapter1
//
Self.lchapter1.Font := System.Drawing.Font.Create('Times
New Roman', 9, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.lchapter1.Location := System.Drawing.Point.Create(48,
120);
Self.lchapter1.Name := 'lchapter1';
Self.lchapter1.Size := System.Drawing.Size.Create(56, 16);
Self.lchapter1.TabIndex := 9;
Self.lchapter1.Text := 'Chapter :';
//
// lbook1
//
Self.lbook1.Font := System.Drawing.Font.Create('Times New
Roman', 9, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.lbook1.Location := System.Drawing.Point.Create(48,
40);
Self.lbook1.Name := 'lbook1';
Self.lbook1.Size := System.Drawing.Size.Create(56, 16);
Self.lbook1.TabIndex := 8;
Self.lbook1.Text := 'Book :';
//
// ltitle1
//
Self.ltitle1.Font := System.Drawing.Font.Create('Times New
Roman', 9, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.ltitle1.Location := System.Drawing.Point.Create(48,
80);
Self.ltitle1.Name := 'ltitle1';
Self.ltitle1.Size := System.Drawing.Size.Create(56, 16);
Self.ltitle1.TabIndex := 7;
Self.ltitle1.Text := 'Title :';
//
// lbook
//
Self.lbook.Font := System.Drawing.Font.Create('Times New
Roman', 9, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.lbook.Location := System.Drawing.Point.Create(24,
240);
Self.lbook.Name := 'lbook';
Self.lbook.Size := System.Drawing.Size.Create(56, 16);
Self.lbook.TabIndex := 4;
Self.lbook.Text := 'Book :';
//
// ltitle
//
Self.ltitle.Font := System.Drawing.Font.Create('Times New
Roman', 9, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.ltitle.Location := System.Drawing.Point.Create(136,
240);
Self.ltitle.Name := 'ltitle';
Self.ltitle.Size := System.Drawing.Size.Create(48, 16);
Self.ltitle.TabIndex := 5;
Self.ltitle.Text := 'Title :';
//
// lchapter
//
Self.lchapter.Font := System.Drawing.Font.Create('Times
New Roman', 9, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.lchapter.Location := System.Drawing.Point.Create(24,
280);
Self.lchapter.Name := 'lchapter';
Self.lchapter.Size := System.Drawing.Size.Create(56, 16);
Self.lchapter.TabIndex := 6;
Self.lchapter.Text := 'Chapter :';
//
// lverse
//
Self.lverse.Font := System.Drawing.Font.Create('Times New
Roman', 9, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.lverse.Location := System.Drawing.Point.Create(136,
280);
Self.lverse.Name := 'lverse';
Self.lverse.Size := System.Drawing.Size.Create(48, 16);
Self.lverse.TabIndex := 7;
Self.lverse.Text := 'Verse :';
//
// txtbook
//
Self.txtbook.BackColor :=
System.Drawing.SystemColors.Control;
Self.txtbook.BorderStyle :=
System.Windows.Forms.BorderStyle.None;
Self.txtbook.Font := System.Drawing.Font.Create('Times New
Roman', 9, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.txtbook.Location := System.Drawing.Point.Create(88,
240);
Self.txtbook.Name := 'txtbook';
Self.txtbook.Size := System.Drawing.Size.Create(32, 14);
Self.txtbook.TabIndex := 8;
Self.txtbook.Text := '';
Self.txtbook.TextAlign :=
System.Windows.Forms.HorizontalAlignment.Center;
//
// txtchapter
//
Self.txtchapter.BackColor :=
System.Drawing.SystemColors.Control;
Self.txtchapter.BorderStyle :=
System.Windows.Forms.BorderStyle.None;
Self.txtchapter.Font := System.Drawing.Font.Create('Times
New Roman', 9, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.txtchapter.Location :=
System.Drawing.Point.Create(88, 280);
Self.txtchapter.Name := 'txtchapter';
Self.txtchapter.Size := System.Drawing.Size.Create(32,
14);
Self.txtchapter.TabIndex := 9;
Self.txtchapter.Text := '';
Self.txtchapter.TextAlign :=
System.Windows.Forms.HorizontalAlignment.Center;
//
// txtverse
//
Self.txtverse.BackColor :=
System.Drawing.SystemColors.Control;
Self.txtverse.BorderStyle :=
System.Windows.Forms.BorderStyle.None;
Self.txtverse.Font := System.Drawing.Font.Create('Times
New Roman', 9, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.txtverse.Location := System.Drawing.Point.Create(192,
280);
Self.txtverse.Name := 'txtverse';
Self.txtverse.Size := System.Drawing.Size.Create(32, 14);
Self.txtverse.TabIndex := 10;
Self.txtverse.Text := '';
Self.txtverse.TextAlign :=
System.Windows.Forms.HorizontalAlignment.Center;
//
// txttitle
//
Self.txttitle.BackColor :=
System.Drawing.SystemColors.Control;
Self.txttitle.BorderStyle :=
System.Windows.Forms.BorderStyle.None;
Self.txttitle.Font := System.Drawing.Font.Create('Times
New Roman', 9, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.txttitle.Location := System.Drawing.Point.Create(192,
240);
Self.txttitle.Name := 'txttitle';
Self.txttitle.Size := System.Drawing.Size.Create(104, 14);
Self.txttitle.TabIndex := 11;
Self.txttitle.Text := '';
//
// txtdatatext
//
Self.txtdatatext.BackColor :=
System.Drawing.SystemColors.ControlLight;
Self.txtdatatext.Font := System.Drawing.Font.Create('Times
New Roman', 9.75,
System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.txtdatatext.Location :=
System.Drawing.Point.Create(16, 312);
Self.txtdatatext.Multiline := True;
Self.txtdatatext.Name := 'txtdatatext';
Self.txtdatatext.Size := System.Drawing.Size.Create(288,
112);
Self.txtdatatext.TabIndex := 12;
Self.txtdatatext.Text := '';
//
// txtrec
//
Self.txtrec.BackColor :=
System.Drawing.SystemColors.Control;
Self.txtrec.BorderStyle :=
System.Windows.Forms.BorderStyle.None;
Self.txtrec.Font := System.Drawing.Font.Create('Times New
Roman', 9, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.txtrec.Location := System.Drawing.Point.Create(16,
448);
Self.txtrec.Name := 'txtrec';
Self.txtrec.Size := System.Drawing.Size.Create(88, 14);
Self.txtrec.TabIndex := 13;
Self.txtrec.Text := '';
Self.txtrec.TextAlign :=
System.Windows.Forms.HorizontalAlignment.Center;
//
// btnfirst
//
Self.btnfirst.Font := System.Drawing.Font.Create('Times
New Roman', 9.75, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.btnfirst.Location := System.Drawing.Point.Create(120,
440);
Self.btnfirst.Name := 'btnfirst';
Self.btnfirst.Size := System.Drawing.Size.Create(24, 24);
Self.btnfirst.TabIndex := 14;
Self.btnfirst.Text := 'F';
Include(Self.btnfirst.Click, Self.btnfirst_Click);
//
// btnprev
//
Self.btnprev.Font := System.Drawing.Font.Create('Times New
Roman', 9.75, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.btnprev.Location := System.Drawing.Point.Create(144,
440);
Self.btnprev.Name := 'btnprev';
Self.btnprev.Size := System.Drawing.Size.Create(24, 24);
Self.btnprev.TabIndex := 15;
Self.btnprev.Text := 'P';
Include(Self.btnprev.Click, Self.btnprev_Click);
//
// btnnext
//
Self.btnnext.Font := System.Drawing.Font.Create('Times New
Roman', 9.75, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.btnnext.Location := System.Drawing.Point.Create(176,
440);
Self.btnnext.Name := 'btnnext';
Self.btnnext.Size := System.Drawing.Size.Create(24, 24);
Self.btnnext.TabIndex := 16;
Self.btnnext.Text := 'N';
Include(Self.btnnext.Click, Self.btnnext_Click);
//
// btnlast
//
Self.btnlast.Font := System.Drawing.Font.Create('Times New
Roman', 9.75, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.btnlast.Location := System.Drawing.Point.Create(200,
440);
Self.btnlast.Name := 'btnlast';
Self.btnlast.Size := System.Drawing.Size.Create(24, 24);
Self.btnlast.TabIndex := 17;
Self.btnlast.Text := 'L';
Include(Self.btnlast.Click, Self.btnlast_Click);
//
// btnclose
//
Self.btnclose.Font := System.Drawing.Font.Create('Times
New Roman', 9.75, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, (Byte(178)));
Self.btnclose.Location := System.Drawing.Point.Create(240,
440);
Self.btnclose.Name := 'btnclose';
Self.btnclose.Size := System.Drawing.Size.Create(56, 24);
Self.btnclose.TabIndex := 18;
Self.btnclose.Text := 'Done';
Include(Self.btnclose.Click, Self.btnclose_Click);
//
// OleDbConnection1
// Data
Source=C:\App_WFDelphi\pic\KJV2002.mdb;provider=Microsoft.Jet.OLEDB.4.0;
// logical current directory - DataDirectory =
C:\App_WFDelphi\pic\ or
//
Self.OleDbConnection1.ConnectionString := 'Data Source=' +
TMainForm.DataDirectory +
'KJV2002.mdb;provider=Microsoft.Jet.OLEDB.4.0';
//
//
// oleDbSelectCommand1
//
Self.oleDbSelectCommand1.CommandText := 'SELECT Book,
BookTitle, Chapter, TextData, Verse , ID FROM BibleTable
ORDER BY '+
'ID';
Self.oleDbSelectCommand1.Connection :=
Self.OleDbConnection1;
//
// oleDbInsertCommand1
//
Self.oleDbInsertCommand1.CommandText := 'INSERT INTO
BibleTable(Book, BookTitle, Chapter, TextData, Verse)
VALUES (?, ?,'+
' ?, ?, ?)';
Self.oleDbInsertCommand1.Connection :=
Self.OleDbConnection1;
Self.oleDbInsertCommand1.Parameters.Add(System.Data.OleDb.OleDbParameter.Create('Book',
System.Data.OleDb.OleDbType.VarWChar, 50, 'Book'));
Self.oleDbInsertCommand1.Parameters.Add(System.Data.OleDb.OleDbParameter.Create('BookTitle',
System.Data.OleDb.OleDbType.VarWChar, 50, 'BookTitle'));
Self.oleDbInsertCommand1.Parameters.Add(System.Data.OleDb.OleDbParameter.Create('Chapter',
System.Data.OleDb.OleDbType.VarWChar, 50, 'Chapter'));
Self.oleDbInsertCommand1.Parameters.Add(System.Data.OleDb.OleDbParameter.Create('TextData',
System.Data.OleDb.OleDbType.VarWChar, 0, 'TextData'));
Self.oleDbInsertCommand1.Parameters.Add(System.Data.OleDb.OleDbParameter.Create('Verse',
System.Data.OleDb.OleDbType.VarWChar, 50, 'Verse'));
//
// oleDbUpdateCommand1
//
Self.oleDbUpdateCommand1.Connection :=
Self.OleDbConnection1;
//
// oleDbDeleteCommand1
//
Self.oleDbDeleteCommand1.Connection :=
Self.OleDbConnection1;
//
// OleDbDataAdapter1
//
Self.OleDbDataAdapter1.DeleteCommand :=
Self.oleDbDeleteCommand1;
Self.OleDbDataAdapter1.InsertCommand :=
Self.oleDbInsertCommand1;
Self.OleDbDataAdapter1.SelectCommand :=
Self.oleDbSelectCommand1;
Self.OleDbDataAdapter1.UpdateCommand :=
Self.oleDbUpdateCommand1;
//
// BDataSet1
//
Self.BDataSet1.DataSetName := 'BDataSet';
Self.BDataSet1.Locale :=
System.Globalization.CultureInfo.Create('af-ZA');
Self.BDataSet1.Namespace :=
'http://www.changeme.now/BDataSet.xsd';
//
// RichTData
//
Self.RichTData.BorderStyle :=
System.Windows.Forms.BorderStyle.None;
Self.RichTData.Location :=
System.Drawing.Point.Create(344, 184);
Self.RichTData.Name := 'RichTData';
Self.RichTData.Size := System.Drawing.Size.Create(40, 40);
Self.RichTData.TabIndex := 20;
Self.RichTData.Text := '';
Self.RichTData.Visible := False;
//
// TBook
//
Self.AutoScaleBaseSize := System.Drawing.Size.Create(5,
13);
Self.ClientSize := System.Drawing.Size.Create(664, 478);
Self.Controls.Add(Self.RichTData);
Self.Controls.Add(Self.btnclose);
Self.Controls.Add(Self.btnlast);
Self.Controls.Add(Self.btnnext);
Self.Controls.Add(Self.btnprev);
Self.Controls.Add(Self.btnfirst);
Self.Controls.Add(Self.txtrec);
Self.Controls.Add(Self.txtdatatext);
Self.Controls.Add(Self.txttitle);
Self.Controls.Add(Self.txtverse);
Self.Controls.Add(Self.txtchapter);
Self.Controls.Add(Self.txtbook);
Self.Controls.Add(Self.lverse);
Self.Controls.Add(Self.lchapter);
Self.Controls.Add(Self.ltitle);
Self.Controls.Add(Self.lbook);
Self.Controls.Add(Self.TabControl1);
Self.Controls.Add(Self.Panel1);
Self.Controls.Add(Self.PictureBox2);
Self.Controls.Add(Self.PictureBox1);
Self.Icon :=
(System.Drawing.Icon(resources.GetObject('$this.Icon')));
Self.MaximizeBox := False;
Self.Name := 'TBook';
Self.StartPosition :=
System.Windows.Forms.FormStartPosition.CenterScreen;
Self.Text := 'Book ...';
Include(Self.Closed, Self.TBook_Closed);
Self.TabControl1.ResumeLayout(False);
Self.TabPage1.ResumeLayout(False);
Self.TabPage2.ResumeLayout(False);
(System.ComponentModel.ISupportInitialize(Self.BDataSet1)).EndInit;
Self.ResumeLayout(False);
end;
{$ENDREGION}
procedure TBook.Dispose(Disposing: Boolean);
begin
if Disposing then
begin
if Components <> nil then
Components.Dispose();
end;
inherited Dispose(Disposing);
end;
constructor TBook.Create;
var
vrow : Integer;
begin
inherited Create;
//
// Required for Windows Form Designer support
//
InitializeComponent;
//
// TODO: Add any constructor code after
InitializeComponent call
//
// Activate or load data . (Table BibleTable of
KJV2002.mdb )
LoadBDataSet;
// Pictures values ...
self.PictureBox1.Image :=
System.Drawing.Image.FromFile(TMainform.DataDirectory +
'forum.bmp');
self.PictureBox2.Image :=
System.Drawing.Image.FromFile(TMainform.DataDirectory +
'Christus-th.bmp');
// Comboboxes ...
// 1- Cmbbook stores the orders of all books.
// 2- Cmbbookrecno stores the orders of the KJV2002
records corresponding to the items of Cmbbook.
// 3- Cmbtitle stores the titles of books
// 4- Cmbtitlerecno stores the orders of the KJV2002
records corresponding to the items of Cmbtitle.
for vrow := 2 to (self.BDataSet1.Tables[0].Rows.Count - 1)
do
if (self.BDataSet1.Tables[0].Rows[vrow].Item[2].ToString =
'001') and
(self.BDataSet1.Tables[0].Rows[vrow].Item[4].ToString =
'001') then
begin
self.cmbbook.Items.Add(self.BDataSet1.Tables[0].Rows[vrow].Item[0].ToString);
self.cmbtitle.Items.Add(self.BDataSet1.Tables[0].Rows[vrow].Item[1].ToString);
self.cmbbook1.Items.Add (vrow.ToString);
self.cmbtitle1.Items.Add(vrow.ToString);
end;
self.cmbbook.set_Text('Select');
self.cmbtitle.set_Text('Select');
self.cmbchapter.set_Text('no select');
self.cmbverse.set_Text('no select');
// Navigate, data values
VRecno := 2;
SetSRecData(VRecno);
end;
procedure TBook.LoadBDataSet;
begin
self.BDataSet1.EnforceConstraints := False;
Try
//Open the connection.
self.OleDbConnection1.Open();
//Attempt to fill the dataset through the
OleDbDataAdapter1.
self.OleDbDataAdapter1.Fill(self.BDataSet1);
finally
//'Turn constraint checking back on.
self.BDataSet1.EnforceConstraints := True;
//Close the connection whether or not the exception was
thrown.
self.OleDbConnection1.Close();
End;
// StatusBar Panel 1 = Message
// TMainForm..StatusBarPanel1.Text := 'About Form ...';
end;
// Navigate, data values
procedure TBook.SetSRecData(NRec : Integer);
begin
// Book Field
self.txtbook.Text :=
self.BDataSet1.Tables[0].Rows[NRec].Item[0].ToString;
// CookTitle Field
self.txttitle.Text :=
self.BDataSet1.Tables[0].Rows[NRec].Item[1].ToString;
// Chapter Field
self.txtchapter.Text :=
self.BDataSet1.Tables[0].Rows[NRec].Item[2].ToString;
// verse Field
self.txtverse.Text :=
self.BDataSet1.Tables[0].Rows[NRec].Item[4].ToString;
// textData Field
self.txtdatatext.Text :=
self.BDataSet1.Tables[0].Rows[NRec].Item[3].ToString;
self.txtrec.Text := 'Rec : ' + NRec.ToString;
// Navigation Controls
if (NRec = 2) then
begin
self.btnfirst.Enabled := False;
self.btnprev.Enabled := False;
self.btnlast.Enabled := True;
self.btnnext.Enabled := True;
exit;
end;
if (NRec = (self.BDataSet1.Tables[0].Rows.Count - 1)) then
begin
self.btnfirst.Enabled := True;
self.btnprev.Enabled := True;
self.btnlast.Enabled := False;
self.btnnext.Enabled := False;
exit;
end;
If (self.btnlast.Enabled = False) Or (self.btnnext.Enabled
= False) Then
begin
self.btnlast.Enabled := True;
self.btnnext.Enabled := True;
end;
If (self.btnfirst.Enabled = False) Or
(self.btnprev.Enabled = False) Then
begin
self.btnfirst.Enabled := True;
self.btnprev.Enabled := True;
end;
end;
procedure TBook.btnfirst_Click(sender: System.Object; e:
System.EventArgs);
begin
// 1st record .
VRecno := 2;
SetSRecData(VRecno);
end;
procedure TBook.btnprev_Click(sender: System.Object; e:
System.EventArgs);
begin
// Preview record .
VRecno := VRecno - 1;
SetSRecData(VRecno);
end;
procedure TBook.btnnext_Click(sender: System.Object; e:
System.EventArgs);
begin
// Next record .
VRecno := VRecno + 1;
SetSRecData(VRecno);
end;
procedure TBook.btnlast_Click(sender: System.Object; e:
System.EventArgs);
begin
// Last record .
VRecno := (self.BDataSet1.Tables[0].Rows.Count - 1);
SetSRecData(VRecno);
end;
class function TBook.Showbook:
System.Windows.Forms.DialogResult;
begin
with TBook.Create do
Result := ShowDialog;
end;
procedure TBook.TBook_Closed(sender: System.Object; e:
System.EventArgs);
begin
// StatusBar Panel 1 = Message
TMainForm.SetStatus;
end;
procedure TBook.btnclose_Click(sender: System.Object; e:
System.EventArgs);
begin
// StatusBar Panel 1 = Message
TMainForm.SetStatus;
Close;
end;
// Search by word .
procedure TBook.txtword_KeyPress(sender: System.Object; e:
System.Windows.Forms.KeyPressEventArgs);
begin
If Length(self.txtword.Text) > 1 Then
self.btndisplay.Enabled := True
end;
procedure TBook.btndisplay_Enter(sender: System.Object; e:
System.EventArgs);
begin
self.txtinfo.Text := 'Moment ...';
end;
procedure TBook.btndisplay_Click(sender: System.Object; e:
System.EventArgs);
var
item1 : System.Windows.Forms.ListViewItem;
vrow : Integer;
NVar : Integer;
ii : Integer;
label pta;
label ptb;
begin
// 500 = Max number of serching items found
// SetLength(Arlist, 500);
self.txtword.Enabled := false;
// Clear ...
self.listView1.Clear;
// listview Proprieties
self.listView1.LabelEdit := True;
self.listView1.AllowColumnReorder := True;
self.listView1.FullRowSelect := True;
self.listView1.GridLines := True;
// self.listView1.View := 'Details';
// Column Header, columns collection
self.listView1.Columns.Add('Position', 55,
HorizontalAlignment.Center);
self.listView1.Columns.Add('Book', 40,
HorizontalAlignment.Left);
self.listView1.Columns.Add('Book Title', 80,
HorizontalAlignment.Left);
self.listView1.Columns.Add('Chap', 40,
HorizontalAlignment.Left);
self.listView1.Columns.Add('Verse', 40,
HorizontalAlignment.Left);
for vrow := 2 to (self.BDataSet1.Tables[0].Rows.Count - 1)
do
begin
// Use RichTextgox control to store TextData field
self.RichTData.Text :=
self.BDataSet1.Tables[0].Rows[vrow].Item[3].ToString;
// Search by Word operation, Use the Find function of
RichText control if the TxtWord Value exist
if (self.RichTData.Find(self.txtword.Text.ToLower) <> -1)
then
begin
// Create item and four sets of subitems.
item1 := ListViewItem.Create(vrow.ToString, 0);
Item1.SubItems.Add(self.BDataSet1.Tables[0].Rows[vrow].Item[0].ToString);
Item1.SubItems.Add(self.BDataSet1.Tables[0].Rows[vrow].Item[1].ToString);
Item1.SubItems.Add(self.BDataSet1.Tables[0].Rows[vrow].Item[2].ToString);
Item1.SubItems.Add(self.BDataSet1.Tables[0].Rows[vrow].Item[4].ToString);
Self.ListView1.Items.AddRange([Item1]);
// Number of verse found
NVar := NVar + 1;
end;
end;
If NVar = 0 Then
Begin
self.txtinfo.Text := 'Search for ' +
self.txtword.Text.ToLower + ' - ' + NVar.ToString + '
items found';
goto ptb;
end;
pta :
// NVar Less or equal 500
self.txtinfo.Text := 'Search for ' +
self.txtword.Text.ToLower + ' - ' + NVar.ToString + '
items found';
ptb :
self.txtword.text := '';
self.txtword.Enabled := True;
self.btndisplay.Enabled := False;
self.txtword.Focus;
end;
procedure TBook.ListView1_Click(sender: System.Object; e:
System.EventArgs);
begin
// convert string to int
VRecno :=
System.Convert.ToInt16(self.ListView1.SelectedItems.Item[0].Text.ToString);
SetSRecData(VRecno);
end;
// Search by Address .
procedure TBook.cmbbook_SelectedIndexChanged(sender:
System.Object; e: System.EventArgs);
var
VPosition : Integer;
vrow : Integer;
begin
//1- Cmbbook stores the orders of all books.
//2- Cmbtitle stores the titles of books
//3- The Cmbchapter stores all chapters orders of the book
corresponding to the item selected
//4- The Cmbverse stores all verses orders of the 1st
chapter of the book
self.cmbchapter.Items.Clear;
self.cmbverse.Items.Clear;
self.cmbchapter1.Items.Clear;
self.cmbverse1.Items.Clear;
self.cmbbook1.set_SelectedIndex(self.cmbbook.get_SelectedIndex);
VPosition :=
System.Convert.ToInt16(self.cmbbook1.get_Text);
for vrow := VPosition to
(self.BDataSet1.Tables[0].Rows.Count - 1) do
begin
if (self.BDataSet1.Tables[0].Rows[vrow].Item[0].ToString =
self.cmbbook.get_Text) then
begin
if (self.BDataSet1.Tables[0].Rows[vrow].Item[4].ToString =
'001') then
begin
self.cmbchapter.Items.Add(self.BDataSet1.Tables[0].Rows[vrow].Item[2].ToString);
self.cmbchapter1.Items.Add (vrow.ToString);
end;
if (self.BDataSet1.Tables[0].Rows[vrow].Item[2].ToString =
'001') then
begin
self.cmbverse.Items.Add(self.BDataSet1.Tables[0].Rows[vrow].Item[4].ToString);
self.cmbverse1.Items.Add(vrow.ToString);
end;
end;
end;
//1- The record displays into the Record data boxes,
includes the following data:
// the order and title of the book corresponding to the
item selected,
// the 1st chapter order of the book,
// the 1st verse order of the 1st chapter
// and the contents of the verse.
// 2- In the Cmbtitle, displays the title of the book
corresponding to the item selected
// 3- In the Cmbbook, displays the item selected
// 4- In the Cmbchapter, displays the 1st chapter order of
the book
// 5- In the Cmbverse, displays the 1st verse order of the
1st chapter
self.cmbtitle.set_SelectedIndex(self.cmbbook.get_SelectedIndex);
self.cmbchapter.set_SelectedIndex(0);
self.cmbverse.set_SelectedIndex(0);
self.cmbbook1.set_SelectedIndex(self.cmbbook.get_SelectedIndex);
VRecno := System.Convert.ToInt16(self.cmbbook1.get_Text);
SetSRecData(VRecno);
end;
procedure TBook.cmbtitle_SelectedIndexChanged(sender:
System.Object; e: System.EventArgs);
var
VPosition : Integer;
vrow : Integer;
begin
//1- Cmbbook stores the orders of all books.
//2- Cmbtitle stores the titles of books
//3- The Cmbchapter stores all chapters orders of the book
corresponding to the item selected
//4- The Cmbverse stores all verses orders of the 1st
chapter of the book
self.cmbchapter.Items.Clear;
self.cmbverse.Items.Clear;
self.cmbchapter1.Items.Clear;
self.cmbverse1.Items.Clear;
self.cmbtitle1.set_SelectedIndex(self.cmbtitle.get_SelectedIndex);
VPosition :=
System.Convert.ToInt16(self.cmbtitle1.get_Text);
for vrow := VPosition to
(self.BDataSet1.Tables[0].Rows.Count - 1) do
begin
if (self.BDataSet1.Tables[0].Rows[vrow].Item[1].ToString =
self.cmbtitle.get_Text) then
begin
if (self.BDataSet1.Tables[0].Rows[vrow].Item[4].ToString =
'001') then
begin
self.cmbchapter.Items.Add(self.BDataSet1.Tables[0].Rows[vrow].Item[2].ToString);
self.cmbchapter1.Items.Add (vrow.ToString);
end;
if (self.BDataSet1.Tables[0].Rows[vrow].Item[2].ToString =
'001') then
begin
self.cmbverse.Items.Add(self.BDataSet1.Tables[0].Rows[vrow].Item[4].ToString);
self.cmbverse1.Items.Add(vrow.ToString);
end;
end;
end;
// 1- The record displays into the Record data boxes,
includes the following data:
// the order and title of the book corresponding to the
item selected,
// the 1st chapter order of the book,
// the 1st verse order of the 1st chapter
// and the contents of the verse.
// 2- In the Cmbtitle, displays the item selected
// 3- In the Cmbbook, displays the title of the book
corresponding to the item selected
// 4- In the Cmbchapter, displays the 1st chapter order of
the book
// 5- In the Cmbverse, displays the 1st verse order of the
1st chapter
self.cmbbook.set_SelectedIndex(self.cmbtitle.get_SelectedIndex);
self.cmbchapter.set_SelectedIndex(0);
self.cmbverse.set_SelectedIndex(0);
self.cmbtitle1.set_SelectedIndex(self.cmbtitle.get_SelectedIndex);
VRecno := System.Convert.ToInt16(self.cmbtitle1.get_Text);
SetSRecData(VRecno);
end;
procedure TBook.cmbchapter_SelectedIndexChanged(sender:
System.Object; e: System.EventArgs);
var
VPosition : Integer;
vrow : Integer;
begin
self.cmbverse.Items.Clear;
self.cmbverse1.Items.Clear;
self.cmbchapter1.set_SelectedIndex(self.cmbchapter.get_SelectedIndex);
VPosition :=
System.Convert.ToInt16(self.cmbtitle1.get_Text);
for vrow := VPosition to
(self.BDataSet1.Tables[0].Rows.Count - 1) do
begin
if (self.BDataSet1.Tables[0].Rows[vrow].Item[0].ToString =
self.cmbbook.get_Text) and
(self.BDataSet1.Tables[0].Rows[vrow].Item[2].ToString =
self.cmbchapter.get_Text) then
begin
self.cmbverse.Items.Add(self.BDataSet1.Tables[0].Rows[vrow].Item[4].ToString);
self.cmbverse1.Items.Add(vrow.ToString);
end;
end;
//1- The record displays into the Record data boxes,
includes the following data:
//the order and title of the book corresponding to the
item selected,
//the 1st chapter order of the book,
//the 1st verse order of the 1st chapter
//and the contents of the verse.
//2- In the Cmbtitle, displays the title of the book
//3- In the Cmbbook, displays the title of the book
//4- In the Cmbchapter, displays the item selected
//5- In the Cmbverse, displays the 1st verse order of the
1st chapter
self.cmbverse.set_SelectedIndex(0);
self.cmbchapter1.set_SelectedIndex(self.cmbchapter.get_SelectedIndex);
VRecno :=
System.Convert.ToInt16(self.cmbchapter1.get_Text);
SetSRecData(VRecno);
end;
procedure TBook.cmbverse_SelectedIndexChanged(sender:
System.Object; e: System.EventArgs);
begin
//1- The record displays into the Record data boxes,
includes the following data:
//the order and title of the book corresponding to the
item selected,
//the 1st chapter order of the book,
//the 1st verse order of the 1st chapter
//and the contents of the verse.
//2- In the Cmbtitle, displays the title of the book
//3- In the Cmbbook, displays the title of the book
//4- In the Cmbchapter, displays the book chapter
//5- In the Cmbverse, displays the item selected
self.cmbverse1.set_SelectedIndex(self.cmbverse.get_SelectedIndex);
VRecno := System.Convert.ToInt16(self.cmbverse1.get_Text);
SetSRecData(VRecno);
end;
end. | | |
|
|