Advertisement

08.08.2008 at 06:29PM PDT, ID: 23634484
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.9

Form Auto-Close with Timer

Asked by frize in Delphi Programming

Tags:

Hello .

Please Can someone correct me this Project :
It uses 2 Forms
MainForm and Form2

and Tfindfile Components and a Timer

so i want the Form2 will AutoClose after some Seconds

please see the Project for details .

TFindFile : http://www.delphiarea.com/products/findfile/findfile.zip

* How could i assign the ' Don't Show this Again

Thank you All .Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
program Project1;
 
uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1},
  Unit2 in 'Unit2.pas' {Form2};
 
{$R *.res}
 
begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  If Form2=Nil then
  Form2:=TForm2.Create(Application);
  Application.Run;
end.
------------- Unit1
unit Unit1;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, FindFile;
 
type
  TForm1 = class(TForm)
    df: TFindFile;
    CheckBox1: TCheckBox;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure dfFileMatch(Sender: TObject; const Folder: String;
      const FileInfo: TSearchRec);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  Form1: TForm1;
 
implementation
 
uses Unit2;
 
{$R *.dfm}
 
procedure TForm1.Button1Click(Sender: TObject);
begin
df.Execute;// TFindFile
end;
 
procedure TForm1.Button2Click(Sender: TObject);
begin
if df.Busy then
df.Abort;
end;
Function Showp( Dir,Fn:String):Boolean;
begin
Result:=False;
If  Result then
if Form2=Nil then
form2:=tform2.create(Application);
Form2.dir.Caption:=Dir;
Form2.fl.Caption:=Fn;
Form2.ShowAgain;
form2.showmodal();
//form2.free;
 // How to assign the Don't Show Again
// Form1.checked=Not(Form2.CheckBox1.checked);
 
end;
procedure TForm1.dfFileMatch(Sender: TObject; const Folder: String;
  const FileInfo: TSearchRec);
begin
IF df.Threaded then begin
if CheckBox1.Checked then
Showp(Folder,FileInfo.Name);
end;
end;
end.
----------- unit2
unit Unit2;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;
 
type
  TForm2 = class(TForm)
    Button1: TButton;
    Timer1: TTimer;
    Label1: TLabel;
    Label2: TLabel;
    dir: TLabel;
    fl: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    CheckBox1: TCheckBox;
    procedure Timer1Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
   procedure  ShowAgain;
  end;
 
var
  Form2: TForm2;
  Count:Integer;
 
implementation
 
{$R *.dfm}
 
procedure TForm2.Timer1Timer(Sender: TObject);
begin
Inc(Count,1);
Label3.Caption:=IntToStr(Count);
If Count=10 then begin
Form2.ModalResult:=MrOk;
Count:=0;
Timer1.Enabled:=False;
end;
end;
 
procedure TForm2.FormCreate(Sender: TObject);
begin
Count:=0;
Timer1.Interval:=100;
Timer1.Enabled:=true;
end;
 
procedure TForm2.ShowAgain;
begin
Timer1.Enabled:=true;
end;
 
end.
-----------
object Form1: TForm1
  Left = 202
  Top = 105
  Width = 783
  Height = 540
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object CheckBox1: TCheckBox
    Left = 80
    Top = 136
    Width = 273
    Height = 17
    Caption = 'Show Popup form'
    TabOrder = 0
  end
  object Button1: TButton
    Left = 88
    Top = 16
    Width = 75
    Height = 25
    Caption = 'Start'
    TabOrder = 1
    OnClick = Button1Click
  end
  object Button2: TButton
    Left = 176
    Top = 16
    Width = 75
    Height = 25
    Caption = 'Stop'
    TabOrder = 2
    OnClick = Button2Click
  end
  object df: TFindFile
    Criteria.Files.FileName = '*.zip'
    Criteria.Files.Location = 'C:\'
    Criteria.Files.Included.Strings = (
      '*.dll')
    Threaded = True
    OnFileMatch = dfFileMatch
    Left = 120
    Top = 56
  end
end
-------------
object Form2: TForm2
  Left = 350
  Top = 118
  BorderStyle = bsDialog
  Caption = 'Form2'
  ClientHeight = 311
  ClientWidth = 395
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 0
    Top = 32
    Width = 29
    Height = 13
    Caption = 'Path :'
  end
  object Label2: TLabel
    Left = 0
    Top = 64
    Width = 23
    Height = 13
    Caption = 'File :'
  end
  object dir: TLabel
    Left = 32
    Top = 32
    Width = 12
    Height = 13
    Caption = 'dir'
  end
  object fl: TLabel
    Left = 32
    Top = 64
    Width = 6
    Height = 13
    Caption = 'fl'
  end
  object Label3: TLabel
    Left = 72
    Top = 152
    Width = 31
    Height = 13
    Caption = 'Label3'
  end
  object Label4: TLabel
    Left = 0
    Top = 152
    Width = 70
    Height = 13
    Caption = 'AutoClose in : '
  end
  object Button1: TButton
    Left = 168
    Top = 248
    Width = 75
    Height = 25
    Caption = 'Button1'
    ModalResult = 1
    TabOrder = 0
  end
  object CheckBox1: TCheckBox
    Left = 8
    Top = 192
    Width = 249
    Height = 17
    Caption = 'Don''t Show Me this Window Again '
    TabOrder = 1
  end
  object Timer1: TTimer
    Enabled = False
    OnTimer = Timer1Timer
    Left = 32
    Top = 232
  end
end
--------------
[+][-]08.09.2008 at 03:59AM PDT, ID: 22195868

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.09.2008 at 09:54AM PDT, ID: 22196840

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Delphi Programming
Tags: Delphi
Sign Up Now!
Solution Provided By: bernani
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628