zgeorge_2
asked on
Databse delphii software solution
how to creat a basic cash register
one main form taking info from the databse and creating buttons using the item name from the databse
and each button would lead to a frChild and again would have diffrent buttons again taking info from the databse
once the item clicked in frChild it comes back to the main window having written the quantity in the datase and had taken the price into the "calculator" on the side of the main form which would at the end calculate the total and the change and again written in the database
eg
main form buttons
drinks specials dinners
fr child
lets say u pressed drinks
Caption "Drinks"
Coffee Orange Juice Pop
once pressed takes back to the main frame
and on the side left corner it says the amount which is taken from the datase and calculates it up
then writtes the amount in the database and shows chang e
i would like to creat something like that
can anybody help me with the scripts
thank yo uy
one main form taking info from the databse and creating buttons using the item name from the databse
and each button would lead to a frChild and again would have diffrent buttons again taking info from the databse
once the item clicked in frChild it comes back to the main window having written the quantity in the datase and had taken the price into the "calculator" on the side of the main form which would at the end calculate the total and the change and again written in the database
eg
main form buttons
drinks specials dinners
fr child
lets say u pressed drinks
Caption "Drinks"
Coffee Orange Juice Pop
once pressed takes back to the main frame
and on the side left corner it says the amount which is taken from the datase and calculates it up
then writtes the amount in the database and shows chang e
i would like to creat something like that
can anybody help me with the scripts
thank yo uy
what scripts?
ASKER
with all the forms and scripts
ASKER
so it could work as i would like it to
I just did an example of this for another person yesterday, are you the same person. He has a database with Shoe Names (Addidas, Nikes, etc). He wanted the application to create a button for each shoe, when the button is pressed, the price is shown - but you can do anything with the price at this point, for example, add it to currrent transaction amount....etc.
I didn't have his database when i created the example for him, so I used the DB Demo that came with delphi. It creates a Button for each order No, and when the button is clicked it shows the item no from the same record.
Let me know if your interested.
Shane
I didn't have his database when i created the example for him, so I used the DB Demo that came with delphi. It creates a Button for each order No, and when the button is clicked it shows the item no from the same record.
Let me know if your interested.
Shane
ASKER
no i am not the same person at least i don't recall asking this question before
but i would lik eto read a reply to this question since you have already answered that
but i would lik eto read a reply to this question since you have already answered that
K - here ya go
https://www.experts-exchange.com/questions/20670713/graphical-design-delphi.html
Shane
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, DBTables, StdCtrls, ExtCtrls, Grids, DBGrids,
DBCtrls;
type
TForm1 = class(TForm)
MyPanel: TPanel;
Button1: TButton;
Button2: TButton;
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
procedure MyBtnClick(Sender: TObject);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.MyBtnClick(Sender: TObject);
begin
frmDataMod.MyTable.First;
//move to record designated by buttons tag property
frmDataMod.MyTable.MoveBy( TButton(Se nder).Tag) ;
//get price from table, using btntag
ShowMessage(frmDataMod.MyT able.Field ByName('Pa rtNo').asS tring);
end;
procedure TForm1.FormActivate(Sender : TObject);
var
Cols: Integer;
lPos: integer; //init left position
tPos: integer; //init top position
lSpacer: integer; //init left space width
tSpacer: integer; //init top space height
MyBtn: TButton;
begin
Cols:= 0; //init col count;
lPos:= 10; //init left position
tPos:= 10; //init top position
lSpacer:= 10; //init left space width
tSpacer:= 10; //init top space height
frmDataMod.MyTable.First;
while not frmDataMod.MyTable.EOF do
begin
//create button
MyBtn:= TButton.Create(MyPanel);
//assign buttons parent, or it wont be visible
MyBtn.Parent:= MyPanel;
//set buttons position
MyBtn.Left:= lPos;
MyBtn.Top:= tPos;
//assign the tag property to the record number
MyBtn.Tag:= frmDataMod.MyTable.RecNo;
MyBtn.Caption:= frmDataMod.MyTable.FieldBy Name('Orde rNo').asSt ring;
//assign your custom onclick event
MyBtn.OnClick:= MyBtnClick;
Cols:= Cols + 1;
//reset positions
if Cols = 2 then
begin
Cols:= 0;
lpos:= 10;
tPos:= tPos + MyBtn.Height + tSpacer;
end
else
lpos:= lpos + MyBtn.Width + lSpacer;
//go to next record
frmDataMod.MyTable.Next;
Application.ProcessMessage s;
end;
Self.Update;
end;
end.
https://www.experts-exchange.com/questions/20670713/graphical-design-delphi.html
Shane
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, DBTables, StdCtrls, ExtCtrls, Grids, DBGrids,
DBCtrls;
type
TForm1 = class(TForm)
MyPanel: TPanel;
Button1: TButton;
Button2: TButton;
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
procedure MyBtnClick(Sender: TObject);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.MyBtnClick(Sender: TObject);
begin
frmDataMod.MyTable.First;
//move to record designated by buttons tag property
frmDataMod.MyTable.MoveBy(
//get price from table, using btntag
ShowMessage(frmDataMod.MyT
end;
procedure TForm1.FormActivate(Sender
var
Cols: Integer;
lPos: integer; //init left position
tPos: integer; //init top position
lSpacer: integer; //init left space width
tSpacer: integer; //init top space height
MyBtn: TButton;
begin
Cols:= 0; //init col count;
lPos:= 10; //init left position
tPos:= 10; //init top position
lSpacer:= 10; //init left space width
tSpacer:= 10; //init top space height
frmDataMod.MyTable.First;
while not frmDataMod.MyTable.EOF do
begin
//create button
MyBtn:= TButton.Create(MyPanel);
//assign buttons parent, or it wont be visible
MyBtn.Parent:= MyPanel;
//set buttons position
MyBtn.Left:= lPos;
MyBtn.Top:= tPos;
//assign the tag property to the record number
MyBtn.Tag:= frmDataMod.MyTable.RecNo;
MyBtn.Caption:= frmDataMod.MyTable.FieldBy
//assign your custom onclick event
MyBtn.OnClick:= MyBtnClick;
Cols:= Cols + 1;
//reset positions
if Cols = 2 then
begin
Cols:= 0;
lpos:= 10;
tPos:= tPos + MyBtn.Height + tSpacer;
end
else
lpos:= lpos + MyBtn.Width + lSpacer;
//go to next record
frmDataMod.MyTable.Next;
Application.ProcessMessage
end;
Self.Update;
end;
end.
To create a cach register, there are other affects you can do as well, you can also do things like
1.) Make form border style - bsNone; // to prevent resizing & closing of window
2.) Make forms window state - wsMaximized; // to fill in entire screen
2.) Disable ctl Alt DEL to prevent user from shutting app down // prevent user from closing window
3.) Disbale Program from minimizing to task tray.
These are things you would want to do for touch screen apps, which is basically what your creating when creating a cash register.
Shane
1.) Make form border style - bsNone; // to prevent resizing & closing of window
2.) Make forms window state - wsMaximized; // to fill in entire screen
2.) Disable ctl Alt DEL to prevent user from shutting app down // prevent user from closing window
3.) Disbale Program from minimizing to task tray.
These are things you would want to do for touch screen apps, which is basically what your creating when creating a cash register.
Shane
You'll want to do your Nested child requests using the custom on click button events
procedure TForm1.MyBtnClick(Sender: TObject);
begin
frmDataMod.MyTable.First;
//move to record designated by buttons tag property
frmDataMod.MyTable.MoveBy(
//get price from table, using btntag
ShowMessage(frmDataMod.MyT
end;
In my example, i get and display another field from the same record, however, you will want to get data from a child table.
Shane
Shane
ASKER
do u mind giving me a working file with that
please
thanks a lot
please
thanks a lot
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
my e-mail is george@unipos.com
Thanks Buddy!
Shane
Shane
You might want to post the source code here for others to use..... cause thats what this is all about.
Shane
Shane
ASKER
THE SOURCE FOR THE REGISTER
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, DBTables, StdCtrls, ExtCtrls, Grids, DBGrids,
DBCtrls;
type
TForm1 = class(TForm)
MyPanel: TPanel;
Button1: TButton;
Button2: TButton;
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
procedure MyBtnClick(Sender: TObject);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.MyBtnClick(Sender: TObject);
begin
frmDataMod.MyTable.First;
//move to record designated by buttons tag property
frmDataMod.MyTable.MoveBy( TButton(Se nder).Tag) ;
//get price from table, using btntag
ShowMessage(frmDataMod.MyT able.Field ByName('Pa rtNo').asS tring);
end;
procedure TForm1.FormActivate(Sender : TObject);
var
Cols: Integer;
lPos: integer; //init left position
tPos: integer; //init top position
lSpacer: integer; //init left space width
tSpacer: integer; //init top space height
MyBtn: TButton;
begin
Cols:= 0; //init col count;
lPos:= 10; //init left position
tPos:= 10; //init top position
lSpacer:= 10; //init left space width
tSpacer:= 10; //init top space height
frmDataMod.MyTable.First;
while not frmDataMod.MyTable.EOF do
begin
//create button
MyBtn:= TButton.Create(MyPanel);
//assign buttons parent, or it wont be visible
MyBtn.Parent:= MyPanel;
//set buttons position
MyBtn.Left:= lPos;
MyBtn.Top:= tPos;
//assign the tag property to the record number
MyBtn.Tag:= frmDataMod.MyTable.RecNo;
MyBtn.Caption:= frmDataMod.MyTable.FieldBy Name('Orde rNo').asSt ring;
//assign your custom onclick event
MyBtn.OnClick:= MyBtnClick;
Cols:= Cols + 1;
//reset positions
if Cols = 2 then
begin
Cols:= 0;
lpos:= 10;
tPos:= tPos + MyBtn.Height + tSpacer;
end
else
lpos:= lpos + MyBtn.Width + lSpacer;
//go to next record
frmDataMod.MyTable.Next;
Application.ProcessMessage s;
end;
Self.Update;
end;
end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, DBTables, StdCtrls, ExtCtrls, Grids, DBGrids,
DBCtrls;
type
TForm1 = class(TForm)
MyPanel: TPanel;
Button1: TButton;
Button2: TButton;
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
procedure MyBtnClick(Sender: TObject);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.MyBtnClick(Sender: TObject);
begin
frmDataMod.MyTable.First;
//move to record designated by buttons tag property
frmDataMod.MyTable.MoveBy(
//get price from table, using btntag
ShowMessage(frmDataMod.MyT
end;
procedure TForm1.FormActivate(Sender
var
Cols: Integer;
lPos: integer; //init left position
tPos: integer; //init top position
lSpacer: integer; //init left space width
tSpacer: integer; //init top space height
MyBtn: TButton;
begin
Cols:= 0; //init col count;
lPos:= 10; //init left position
tPos:= 10; //init top position
lSpacer:= 10; //init left space width
tSpacer:= 10; //init top space height
frmDataMod.MyTable.First;
while not frmDataMod.MyTable.EOF do
begin
//create button
MyBtn:= TButton.Create(MyPanel);
//assign buttons parent, or it wont be visible
MyBtn.Parent:= MyPanel;
//set buttons position
MyBtn.Left:= lPos;
MyBtn.Top:= tPos;
//assign the tag property to the record number
MyBtn.Tag:= frmDataMod.MyTable.RecNo;
MyBtn.Caption:= frmDataMod.MyTable.FieldBy
//assign your custom onclick event
MyBtn.OnClick:= MyBtnClick;
Cols:= Cols + 1;
//reset positions
if Cols = 2 then
begin
Cols:= 0;
lpos:= 10;
tPos:= tPos + MyBtn.Height + tSpacer;
end
else
lpos:= lpos + MyBtn.Width + lSpacer;
//go to next record
frmDataMod.MyTable.Next;
Application.ProcessMessage
end;
Self.Update;
end;
end.
No crazy, email the zip file to me!
Shane
Shane
ASKER
i send it ot you by e-amil
this is just source code for other people
so they can use it
this is just source code for other people
so they can use it
K- Thanks!
Shane
Shane