I am having to modify a program that was thrown together by my former boss, he was originally an RPG programmer and doesn't use OOP techniques quite right, so I apologize for the code. I was trying to retool this program with my previous question regarding Quick Reports and while I'm still planning on re-doing the whole thing, I don't have the time right now and have resolved myself to making the existing program work correctly instead of fixing the whole thing.
So, onto the question:
I have a form with a page control. The page control has 6 tabsheets each with a string grid on it. The form has a button that prints all the tabsheets. The users would like it modified to only print the current tabsheet. How can I determine which tabsheet is the one the user is currently on?
here's the {ugly} code currently in the print button:
Leslie
Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual
So, onto the question:
I have a form with a page control. The page control has 6 tabsheets each with a string grid on it. The form has a button that prints all the tabsheets. The users would like it modified to only print the current tabsheet. How can I determine which tabsheet is the one the user is currently on?
here's the {ugly} code currently in the print button:
Code:
procedure TForm_CasesDisposed.BitBtn3Click(Sender: TObject);
begin
with Form_QRCasesDisposed do
begin
// --------------------------------------------------------------------
// Tab1/Grid1
// --------------------------------------------------------------------
Form_QRCasesDisposed.QRLb_CaseType.caption:=TabSheet1.Caption;
QRStringGrid:=StringGrid1;
CreateLabels;
// Print the report
QuickRep1.Print;
// Free the labels on the report
FreeLabels;
// --------------------------------------------------------------------
// Tab2/Grid2
// --------------------------------------------------------------------
Form_QRCasesDisposed.QRLb_CaseType.caption:=TabSheet2.Caption;
QRStringGrid:=StringGrid2;
CreateLabels;
// Print the report
QuickRep1.Print;
// Free the labels on the report
FreeLabels;
// --------------------------------------------------------------------
// Tab3/Grid3
// --------------------------------------------------------------------
Form_QRCasesDisposed.QRLb_CaseType.caption:=TabSheet3.Caption;
QRStringGrid:=StringGrid3;
CreateLabels;
// Print the report
QuickRep1.Print;
// Free the labels on the report
FreeLabels;
// --------------------------------------------------------------------
// Tab4/Grid4
// --------------------------------------------------------------------
Form_QRCasesDisposed.QRLb_CaseType.caption:=TabSheet4.Caption;
QRStringGrid:=StringGrid4;
CreateLabels;
// Print the report
QuickRep1.Print;
// Free the labels on the report
FreeLabels;
// --------------------------------------------------------------------
// Tab5/Grid5
// --------------------------------------------------------------------
Form_QRCasesDisposed.QRLb_CaseType.caption:=TabSheet5.Caption;
QRStringGrid:=StringGrid5;
CreateLabels;
// Print the report
QuickRep1.Print;
// Free the labels on the report
FreeLabels;
// --------------------------------------------------------------------
// Tab6/Grid6
// --------------------------------------------------------------------
Form_QRCasesDisposed.QRLb_CaseType.caption:=TabSheet6.Caption;
QRStringGrid:=StringGrid6;
CreateLabels;
// Print the report
QuickRep1.Print;
// Free the labels on the report
FreeLabels;
end;
end;
Leslie
Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual