Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set to read only

Status
Not open for further replies.

lespaul

Programmer
Joined
Feb 4, 2002
Messages
7,083
Location
US
I have a juror information form that if certain conditions apply I only want the users to have read only access. Most of the information on the form is in DBEdit controls, a few DB radio groups and check boxes, one look up combo box. Now I only want jurors who meet specific criteria to allow edits, the rest I want read only. Is there an easy way to make the whole form read only or should I just loop through all the components on the form and set enabled := False?


thanks for any pointers!

les
 
You could make the underlying TTable read-only - if that's not pretty, then doing a simple loop through the controls sounds easy enough.
 
Ok, I'm now finally trying to implement this "feature" (safeguarding myself from the users errors!).

The only way I know to do this would be:

Code:
For i := 0 to ComponentCount - 1 do
begin
  If Components[i] is TQuery Then
    with Components[i] as TQuery do
    begin
      if State = dsEdit then
        post;
    end;
end;

Do I need to do the same thing for each KIND of object on my form? ie search for all the DBEdits and make them enabled := False, then do the same for all the comboBoxes, etc? Or is there some easier way to make all the components on the form read only?

Thanks!

Leslie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top