Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to use a loop to catch edit control values Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
28-Aug-02
Category
Database-VCL
Language
Delphi 2.x
Views
122
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			 Author: Tomas Rutkauskas

I want to check if the user has filled all required DBEdit controls on a notebook, 
before enabling a button on the form.

Answer:

If you dropped the controls onto the notebook at design time, their Owner will be 
the form not the notebook. This means that it will not belong to the Components 
array of the notebook, but of the form. The Notebook's Controls array will be all 
the controls it parents and that is probably the array you want to loop through.

1   procedure TAddFrm.SetNextBtn;
2   var
3     I: Integer;
4     fld: TControl;
5     fldEmpty: Boolean;
6   begin
7     fldEmpty := False;
8     with Notebook do
9     begin
10      for I := 0 to ControlCount - 1 do
11      begin
12        fld := Controls[i];
13        if (fld is TDBEdit) then
14        begin
15          fldEmpty := TDBEdit(fld).GetTextLen = 0;
16          if fldEmpty then
17            Break;
18        end
19      end;
20      AddfrmNextBtn.Enabled := not fldEmpty;
21    end;
22  end;
23  
24  if fldName is TCustomEdit then
25    fldEmpty := TCustomEdit(fldName).GetTextLen = 0;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC